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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Add comment