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
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
- Scene view has Y coordinates of the Screen Position node flipped when some of the URP features are disabled
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
Add comment