A downloadable Unity WebGL Template

Download NowName your own price

Minimal WebGL build template.

Features:

  • Scales canvas to fit the window horizontally + vertically while maintaining aspect ratio (can be disabled)
  • Centers canvas in window
  • Customizable background

To use:

  1. Download and unzip
  2. Copy the "WebGLTemplates" folder into your project's "Assets" folder
  3. File -> Build Settings... -> WebGL -> Player Settings... -> Select the "BetterMinimal" template
  4. (Optional) Customize colour in the "Background" field; enter "false" in the "Scale to fit" field to disable scaling

Ideal for embedding on sites like itch.io which provide an external full-screen button.

StatusReleased
CategoryTool
Rating
(8)
AuthorSean
Made withUnity
TagsMeaningful Choices, Unity
LicenseMIT License

Download

Download NowName your own price

Click download now to get access to the following files:

better-minimal-webgl-template-source.zip 2 kB
Version 1

Comments

Log in with itch.io to leave a comment.

Wow, this is really useful! Setting 'scale to fit' to false would be perfect for me, but it doesn't seem to actually change the dimensions & aspect ratio of the camera the way it should. The boarders of the screen get cut off. Likely a problem with Unity itself.

What kind of license is this under? I plan to release the source code of my game... Do I need to mention you somewhere?

(1 edit) (+1)

MIT license; attribution is appreciated but not required

(updated the metadata to reflect this)

Thanks for the amazing template! It works great in Chrome and saved the day for my project. 

I was wondering if focusing the canvas element after entering fullscreen mode would help Estecka's issue. I noticed for me as well that after going into fullscreen you need to click on the canvas element to resume the game loop.

Would be nice to have the auto-detection working. Does adding the "width" and "height" properties in the style attribute of the "gameContainer" div work?

(1 edit) (+1)

Works great !
Though for some reason, when enabling Itch.io's fullscreen on firefox, the game remains scaled down until you click it again. (No issue on chrome)

Another thing that is not an issue but worth noting:
Whereas Itch.io can usually find the canvas' size for Unity games automatically, this template requires setting the canvas size manually.

(1 edit) (+1)

Hey, thanks for the feedback! I'll try to take some time to look into those issues.

Edit: looks like the first issue is on Unity's end (the canvas does in fact resize, but Unity's not updating till it's been focused). RE the auto-detect size, I spent a bit of time tinkering to see if I could figure out where they're pulling the size from without success; I've submitted a feature request on itch.io's github about it though, and will update this if more info on the auto-detect becomes available.