My very first project: Space Shooter

Building your Unity game for the web

Or just run it on your browser

One of the best ways to showcase your hours of labor is to host it online. There are many ways of doing it, for example with your own server or uploading the game to some hosting platform etc. But before you can do that, you have to build your game a bit differently than when you’re building it for a desktop OS.

Namely you have to select the WebGL as your platform. WebGL provides a cross-platform support for 2D or 3D rendering in any web browser that supports it.

So, to build your game for WebGL, first we have to switch the platform in the Build Settings menu (ctrl+shift+b) from PC to WebGL. Once you press the Switch Platform button Unity will compile your project and when that is done you can build it the same way as for the PC.

Since I used a better color space than WebGL supports, I have to address that before I can build my game. The problematic option can be found by going into the Player Settings, selecting WebGL, and changing the Linear to Gamma in the Color Space options.

Once the build has finished, Unity has produced all the necessary files for my game. If I find a good host service, I can move those files there and give other people the possibility to play my game. But for now I test it with the local version which opens once the build is finished.

Unity game developer in the making.