How do I make a Unity game playable in a desktop browser?


The Unity engine offers developers the ability to create WebGL builds of their games, making 2D and 3D games playable in most major web browsers. These builds alleviate the need for players to install plug-ins or download files for a game to be played. This article explains how Unity developers can build desktop browser games with WebGL and host them on the web.

This article applies to all Unity Editor versions from 2019.3 and on, as well as all Unity Hub versions from 3.0 and on.

Note: WebGL provides gameplay support for any platform with a browser, which includes many mobile and console platforms. However, WebGL builds are most efficient for desktop games that aren't graphically demanding, so this article is intended for such games.


Table of Contents


Install WebGL build module

When a version of the Unity Editor is installed, the WebGL build module is not automatically included with it. The following steps ensure the WebGL Build Support module is added to your editor.

  1. Open Unity Hub and select 'Projects' on the sidebar.

  2. Find the project you want to make playable in the browser and identify its editor version.

  3. Install Image 1

  4. Select 'Installs' on the sidebar and find the Unity Editor install corresponding to the version used in your project.

  5. If a 'WebGL' label appears under the install's file path, then you're ready to configure your project's build settings.

  6. Install Image 2

  7. If the Unity Editor install doesn't have a 'WebGL' label, click the install's settings icon, then select 'Add modules'.

  8. Install Image 3

  9. In the popup window that appears, check the 'WebGL Build Support' option listed under 'Platforms', then click the blue 'Install' button.

  10. Install Image 4

  11. In the Downloads window, your project's Unity Editor install should be listed under 'Active' while the WebGL Build Support module downloads. Once the module is finished downloading, the install will move under 'Recent'.

  12. Install Image 5

Back to top


Configure build settings

With the WebGL Build Support module installed, your project can be turned into a WebGL build.

  1. In the Unity Hub, select 'Projects' and open the project you want to make playable in the browser.

  2. In the Unity Editor, select 'File > Build Settings...' from the menu bar to open the Build Settings window. Alternatively, you can use the shortcut Ctrl+Shift+B to open the window.

  3. Configure Image 1

  4. Under the Platform panel, choose the 'WebGL' option. If there isn't a Unity logo on the right side of the 'WebGL' option, click the 'Switch Platform' button. When the project is done switching platforms, the Unity logo will appear next to 'WebGL' in the Platform panel.

  5. Configure Image 2

    Configure Image 3

  6. With the project configured to the WebGL platform, you can change settings such as texture compression, code optimization, and maximum texture size to your liking.

  7. Note: Clicking 'Player Settings...' in the bottom-left corner will open a window with dozens of settings options. Although out of the scope of this article, you can read about them in Unity's documentation.

  8. Ensure that all of the scenes you want in your game appear in the 'Scenes In Build' panel with a checkmark and index number next to them. Scenes can be added to the build by dragging them from the Unity Editor's Project window into the 'Scenes In Build' panel, or by opening the scenes and clicking 'Add Open Scenes' below the 'Scenes In Build' panel. The scene with index 0 will appear first when the game is launched.

  9. Configure Image 4

Back to top


Build and publish a game on the web

Developers can choose between numerous websites for hosting their WebGL games, including their own websites. The two choices discussed in this article are itch.io and Unity Play.

Many independent game developers use itch.io because it allows games to be monetized, supports both downloadable and browser games, and doesn't restrict which engines can be used to create games hosted on the site.

Unity Play is less popular and only supports WebGL builds created with Unity, but its integration into the Unity engine enables a simple and automated method of uploading games to the site.

Build and publish a game on itch.io

Build the game

  1. In the Unity Editor, open the Build Settings window using 'File > Build Settings...' from the menu bar, or by using Ctrl+Shift+B.

  2. With 'WebGL' selected in the Platform panel, click 'Build'.

  3. Build Itch Image 1

  4. A popup window for your computer's file system will appear. Create an appropriately named folder for your build data, then select it.

  5. Note: The build folder can go in your project's root folder, but it cannot be placed in the 'Assets' folder.

    Build Itch Image 2

  6. Once the game is finished building, find the build folder in your file system and compress it into a ZIP file. The steps for compressing a folder into a ZIP file vary by operating system.

  7. Build Itch Image 3

Publish the game on itch.io

  1. Open itch.io in a browser and log in or register for an account.

  2. Click the arrow in the top-right corner of the page, then select 'Upload new project' to enter the 'Edit game' page.

  3. Publish Itch Image 1

  4. Type your game's title into the Title field.

  5. Publish Itch Image 2

  6. Under 'Classification', select 'Games'. Under 'Kind of project', select 'HTML'.

  7. Publish Itch Image 3

    Publish Itch Image 4

  8. Under 'Uploads', click the 'Upload files' button, locate the zipped build folder in your file system, and select it. Check the 'This file will be played in the browser' option.

  9. Publish Itch Image 5

    Publish Itch Image 6

  10. Set the viewport dimensions based on your game's intended aspect ratio.

  11. Publish Itch Image 7

  12. Fill out all other fields to your liking, such as the tagline, cover image, frame options, description, and genre.

  13. If you want your game to be released to the public, select 'Public' under 'Visibility & access'. Otherwise, select 'Draft' or 'Restricted'.

  14. Publish Itch Image 8

  15. When you're ready, click 'Save' and then 'View page' to see your game run in the browser.

  16. Publish Itch Image 9

  17. You can click 'Edit game' at the top of the play screen to go back and adjust the settings. You can also click 'Edit theme' to change your webpage's background and text colors.

  18. Publish Itch Image 10

Build and publish a game on Unity Play

  1. From the Unity Editor menu bar, select 'Window > Package Manager' to open the Package Manager window.

  2. Unity Play Image 1

  3. For the 'Packages' dropdown, choose 'Unity Registry'.

  4. Unity Play Image 2

  5. Search for 'WebGL Publisher' and click 'Install'.

  6. Note: The most recent version of the WebGL Publisher package is version 4.2.3, which works for Unity Editor versions from 2019.3 and on.

    Unity Play Image 3

  7. From the Unity Editor menu bar, select 'Publish > WebGL Project' to make the Publish window appear.

  8. Unity Play Image 4

  9. Click 'Get started', then 'Build and Publish'.

  10. Unity Play Image 5

  11. A popup window for your computer's file system will appear with a new folder called 'WebGL Builds' open. Create an appropriately named folder for your build data within 'WebGL Builds', then select it.

  12. Unity Play Image 6

  13. Once the game is finished building, a browser tab will appear containing the edit screen for your game on Unity Play.

  14. Note: You will automatically be logged into your Unity account. You need a Unity account to use the Unity Editor and publish games on Unity Play.

  15. In Unity Play, add a thumbnail for your game and fill out its title and description fields.

  16. Unity Play Image 7

  17. Click 'Play' to play your game in the browser. The first 15 seconds of your playthrough can be used as a preview for the game. You can choose to re-record the preview.

  18. Unity Play Image 8

  19. When you're ready, click 'Save'. You can return to the edit screen by clicking the three-dots icon in the play screen, and then selecting 'Edit' in the dropdown.

  20. Unity Play Image 9

    Unity Play Image 10

Back to top