Search Issue Tracker
Fixed in 5.3.0
Votes
0
Found in
5.2.0b4
Issue ID
716643
Regression
No
[WebGL] Undocumented template restrictions
-e: WebGL Templates require LOADER_GLUE to be in 'index.html'; WebGL Template iframes make you rename files
I created a WebGL template. In WebGLTemplates, I had a simple 'index.html' with an iframe. The iframe had an href to 'unityContent.html', which was also in WebGLTemplates. 'unityContent.html' contained the <canvas> and %UNITY_WEBGL_LOADER_GLUE% elements.
Unity couldn't handle this. It failed to compile, with the error:
File "PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc", line 1656, in assert '{{{ SCRIPT }}}' in shell, 'HTML shell must contain {{{ SCRIPT }}} , see src/shell.html for an example' AssertionError: HTML shell must contain {{{ SCRIPT }}} , see src/shell.html for an example
So in my WebGLTemplates, I renamed 'index.html' to 'index_wrapper.html', and renamed 'unityContent.html' to 'index.html'. This built just fine. Then, in the build, I renamed 'index.html' back to 'unityContent.html', and renamed 'index_wrapper.html' back to 'index.html'. This ran the webgl player just fine.
None of this is documented, and needs to appear in the unity manual.
-REPRO:
Observe the templates in the project: one ('works') has %UNITY_WEBGL_LOADER_GLUE% in index.html, and one ('broken') has %UNITY_WEBGL_LOADER_GLUE% in an html file referenced by an iframe in index.html.
Open WebGL player settings. Build with 'broken' and 'works', and observer that 'broken' fails to build while 'works' succeeds. While 'works' succeeds the build process, files must be renamed to achieve the desired iframe layout.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Add comment