WebGL Custom Template Support

WebGL Custom Template Support

We’re happy to share that Unity Build Automation now supports using custom templates for WebGL builds, and UBA will no longer force WebGL builds to build with the default template. We know this is something you might have been wanting for a long time, and we’re glad it’s finally here.

Currently WebGL target builds (using either default or custom templates) are only supported on the Mac Builder operating system (OS). Later this year we plan to enable support for WebGL on Windows OS Builders - we’ll share more on that later in the year.

Configuring a custom template for your WebGL build is handled entirely in your Unity project, please refer to the Unity Manual for details on how to set this up: Unity - Manual: WebGL templates

Once you’ve updated your project to use a custom template - and ensured that your project builds locally - make sure that your changes are checked into source control, and you should be ready to build your custom template WebGL build with UBA.

Playing WebGL Builds from the Dashboard

If you already use UBA to build for WebGL, you’re likely aware that the UBA dashboard gives you the ability to play your WebGL build within the dashboard, for testing purposes.

With the introduction of custom templates, we can’t guarantee that your build will play or display properly when played in the dashboard - we won’t stop you from trying to play your build in the dashboard if you’re using a custom template, but we won’t be able to support you if it doesn’t work as you expect.

Playing WebGL builds using the default template will continue to function as before.

6 Likes

As far as I can see, it’s still not possible to configure a custom template in the Unity Cloud Build configuration. This means that we have to configure it in the repo.
This results in not being able to run one template on local machines and another template in the build cloud.
It should be possible to specify the template in the cloud build configuration.

Are there any progress with this?

Very good move. I’m glad this is finally possible.

You could do something like this in OnPreprocessBuild:

#if UNITY_CLOUD_BUILD
    PlayerSettings.WebGL.template = "PROJECT:CloudBuildWebGLTemplate";
#else
    PlayerSettings.WebGL.template = "PROJECT:LocalWebGLTemplate";
#endif
5 Likes

That’s correct, you do have to configure the template in your repo. At the moment we aren’t planning to add anything to the UBA config to allow specifying a different template to what is used locally, but @Shredsauce 's suggestion should work well if that’s something you want to try.

That’s great news. It took a while, but I’m glad this has finally been implemented.

Hello
Is there any way we can create custom boolean macros in templates?
so that we get a checkbox in unity player setting