Creating a WebGL Build in Unity3D

Objective: Create a WebGL build of a Unity game to run and test the game in a web browser.

Step 1: In Unity, go to the File menu, and select Build Settings…. Ensure that the scenes that are part of this build are selected in the Scenes In Build section, and in the Platform section, select the WebGL option.

With the WebGL build option selected, there are a few additional options presented for the build. The Development Build option provides Profiler support as well as a development console for debugging purposes. With the Development Build option, there are additional options for enabling the Autoconnect Profiler to connect the Unity WebGL content to the Editor, as well as Deep Profiling Support for profiling all function calls within the game, and a Scripts Only option which compiles just the scripts within the game and does not process other assets in the game.

Note: WebGL Development builds are much larger in size than a normal WebGL build and not recommended for publishing.

Step 2: With the desired build options selected, click the Switch Platform button to switch from the PC, Mac & Linux Standalone platform option to the WebGL option.

Once Unity re-compiles the content, click the Build button, which will open a Windows Explorer window. Create a new folder called WebGL Build and select it, then click the Select Folder button to save the WebGL game files.

Once the build is completed, the WebGL game files will be accessible from within the WebGL Build folder, which can now be uploaded to a server for hosting and testing.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store