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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Add comment