I am unable to get my WebGL app running, I just get a blank screen after the loading bar has completed. Tested in Chrome and Edge.
In the Unity IDE, it runs fine. (2019.2.4f1). I am using ShareMyGame.com to test, so that I am confident that the platform supports WebGL. Another tutorial game I uploaded works fine.
I call it an app rather than a game, as it is a simple interface with 5 buttons, a text edit box, and a dynamic list of buttons in a scroll rect. Clicking the buttons starts and stops a timer and saves the times to a List<>.
I read that DateTime can cause issues in WebGL, so I have removed all references to this, and use Unity Time instead.
I have checked the console and there are no error messages. I do not know how to trace potential issues any other way.
UnityLoader.js:4 [UnityCache] 'https://s3-us-west-2.amazonaws.com/sharemygame.com/36d01217-ef1c-45ce-a98a-02c3068852f8/Build/Build.wasm.code.unityweb' successfully revalidated and served from the indexedDB cache
UnityLoader.js:3 You can reduce your startup time if you configure your web server to host .unityweb files using gzip compression.
UnityLoader.js:4 [UnityCache] 'https://s3-us-west-2.amazonaws.com/sharemygame.com/36d01217-ef1c-45ce-a98a-02c3068852f8/Build/Build.data.unityweb' successfully revalidated and served from the indexedDB cache
UnityLoader.js:4 [UnityCache] 'https://s3-us-west-2.amazonaws.com/sharemygame.com/36d01217-ef1c-45ce-a98a-02c3068852f8/Build/Build.wasm.framework.unityweb' successfully revalidated and served from the indexedDB cache
faab3445-12d9-4ba3-85b8-e131493a5d28:8 The devicemotion events are blocked by feature policy. See https://github.com/WICG/feature-policy/blob/master/features.md#sensor-features
registerOrRemoveHandler @ faab3445-12d9-4ba3-85b8-e131493a5d28:8
faab3445-12d9-4ba3-85b8-e131493a5d28:8 The deviceorientation events are blocked by feature policy. See https://github.com/WICG/feature-policy/blob/master/features.md#sensor-features
registerOrRemoveHandler @ faab3445-12d9-4ba3-85b8-e131493a5d28:8
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Loading player data from data.unity3d
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Initialize engine version: 2019.2.4f1 (c63b2af89a85)
UnityLoader.js:4 Creating WebGL 2.0 context.
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Renderer: WebKit WebGL
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Vendor: WebKit
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Version: OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
faab3445-12d9-4ba3-85b8-e131493a5d28:8 GLES: 3
faab3445-12d9-4ba3-85b8-e131493a5d28:8 EXT_color_buffer_float GL_EXT_color_buffer_float EXT_disjoint_timer_query_webgl2 GL_EXT_disjoint_timer_query_webgl2 EXT_float_blend GL_EXT_float_blend EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic KHR_parallel_shader_compile GL_KHR_parallel_shader_compile OES_texture_float_linear GL_OES_texture_float_linear WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb GL_WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info GL_WEBGL_debug_renderer_info WEBGL_debug_shaders GL_WEBGL_debug_shaders WEBGL_lose_context GL_WEBGL_lose_context
faab3445-12d9-4ba3-85b8-e131493a5d28:8 OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle 16823152
faab3445-12d9-4ba3-85b8-e131493a5d28:8 UnloadTime: 0.050000 ms
faab3445-12d9-4ba3-85b8-e131493a5d28:8 Input Manager initialize...
The page does not attempt to render anything and there are no relevant errors in web page console. Perhaps the scene did not load properly for some reason.
Try adding a C# script that logs in its OnLoad() or similar to debug that content is created to the scene? I wonder if it may be just the UI not showing up (if the scene only contained UI content?) for some reason.
I added a sprite and it doesn’t show
I added Debug.Log messages to Awake() and Start() attached to the main camera, and these are not output in the console
It looks like none of my code is ever executed, and there is a more technical issue. Any other ideas welcome.
Thanks for the advice again, I came to the same conclusion a couple of hours ago. 3 days of pain over a rookie error!
The mistake I made was renaming the default scene (there is only one scene) by saving it as a different name. But of course at this stage, the Build Settings have already been set up with the original scene. I even remember thinking it will be fine to not delete the original scene from disk, it’s only a small file.
The final clue that lead me to the answer was when I saw the IDE clear my scene structure as it built (I now know it was loading “SampleScene”). At this point, I changed the background colour of the camera from the default blue to green, and found that when I built the project, the background was still blue…in the words of Obi Wan, this is not the scene you are looking for.
Batvink said the problem was that he didn’t include the scene in the build, because at some point he renamed the original scene and continued work in it.
So verify that you have the correct scene, included in the build settings.
Make sure the scene you are building is added and selected in the first slot.
If it is not, with the scene open click the button indicated OR you can drag and drop it to this dialog as well.