Host Unity projects on GitHub Pages

Have you been working on Unity projects and wanted a way to host your games for free so other people may experience them? With the use of GitHub Pages makes this possible for you to host a build of your Unity project!

In this post I am going to provide you the steps to host your own Unity project using Github Pages.

My Unity game hosted on GitHub pages for free!

Create a WebGL build in Unity

Unity has a build option available that allows you to create a build of your project that can be played in a browser.

The WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering.

Here are the steps to create a WebGL build:

  1. File > Build Settings > HTML5/WebGL.
  2. Install the module if you don’t already have it. This will require restarting Unity.
  3. Player settings > Set the resolution, check run in background, and choose a template.
  4. Click the Build button.
Setting up the build in Unity.

This will create an index.html file and Build/ directory. Depending on the template you chose, it may also create a TemplateData/ directory. You should be able to point your browser at your local index.html and be able to play your build, next we are going to get the build up on GitHub.

Push your WebGL Build to GitHub

Move index.htmlBuild/, and TemplateData/ to the root of your git repository. Commit and push all of these files. Your build files will be accessible online in your GitHub repository, but it will only show the file contents of what is uploaded, while we want the content to be hosted.

If you haven’t used GitHub before I have created a tutorial on how to create a repository.

Set up GitHub Pages

Next up is GitHub Pages.

GitHub Pages is a static site hosting service designed to host your personal, organization, or project pages directly from a GitHub repository.

To set this up in GitHub:

  1. Navigate to your repository > Settings > Pages.
  2. Set Source to master branch and Save.

Navigate to https://<user-name-here><repo-name-here> (mine is and your game will load up. If you can’t access the page yet, give it five minutes then refresh.

There you have it! You have now uploaded a Unity build to GitHub and hosted on GitHub Pages. Here is one of my project setups to compare or check it out:

You can read more about my sprite game on my portfolio, I go through the objective of the project and what I got out of it. Thanks!