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
- [URP] Crash on GameObject::QueryComponentByType when baking a Reflection Probe in an unsaved/untitled Scene
- No Icons are used for the Entry and Exit States in the Inspector when selected in an Animator Controller
- Crash on PlayerMain(int, char const**) when exiting Standalone Player with a Particle System in the Scene
- No Icon is used for the Runtime Animator Controller Type in a Search Window when assigning an Animator Controller in the Animator Component
- Unity Version Control server textfield’s text overlaps with the dropdown triangle button in the Explore repositories window when an organization with a long name is selected
Add comment