Unable to build with WebGL Template

I’ve created a custom template for WebGL which I can choose when I build the project (as I’ve done with WebPlayer templates in the past) but when building with anything other than the default template I receive the following error:

Failed running python “/Applications/Unity 5.1.1f1/Unity.app/Contents/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc” @“/Users/whoever/whatever/Assets/…/Temp/emcc_arguments.resp”

stdout:
stderr:
e[0;33mwarning:e[0m emitted code will contain very large numbers of local variables, which is bad for performance (build to JS with -O2 or above to avoid this - make sure to do so both on source files, and during ‘linking’)
warning: unresolved symbol: glFlushMappedBufferRange
warning: unresolved symbol: glGetInternalformativ
warning: unresolved symbol: tcflush
warning: unresolved symbol: pthread_create
warning: unresolved symbol: _ZN4FMOD13DSPConnection6setMixEf
warning: unresolved symbol: glUnmapBuffer
warning: unresolved symbol: glGetStringi
warning: unresolved symbol: glProgramBinary
warning: unresolved symbol: glMapBufferRange
warning: unresolved symbol: glGetProgramBinary
warning: unresolved symbol: glCopyBufferSubData
Traceback (most recent call last):
File “/Applications/Unity 5.1.1f1/Unity.app/Contents/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

Using Unity 5.1.1f1 on a Mac.

Any tips?

Hello,

it works well for me. Can you submit a bug report with the project attached that is showing the issue for you?

I was getting the same error.
In WebGLTemplates, I had a simple ‘index.html’ with an iframe.
The iframe referred 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 that error.

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.

Thanks @prestonmatterport for submitting a repro project.
We are tracking it as a bug now.