Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Simple WebGL app shows blank screen after loading

Discussion in 'WebGL' started by batvink, Sep 27, 2019.

  1. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    Hi,

    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.

    https://www.sharemygame.com/share/36d01217-ef1c-45ce-a98a-02c3068852f8 (Available until 26/09/2019)

    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<>.


    ss1.jpg

    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.

    Any help appreciated!
     
  2. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    Here is the Console details...


    Code (CSharp):
    1. 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
    2.  
    3. UnityLoader.js:3 You can reduce your startup time if you configure your web server to host .unityweb files using gzip compression.
    4.  
    5. 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
    6.  
    7. 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
    8.  
    9. 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
    10. registerOrRemoveHandler @ faab3445-12d9-4ba3-85b8-e131493a5d28:8
    11.  
    12. 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
    13. registerOrRemoveHandler @ faab3445-12d9-4ba3-85b8-e131493a5d28:8
    14.  
    15. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Loading player data from data.unity3d
    16.  
    17. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Initialize engine version: 2019.2.4f1 (c63b2af89a85)
    18.  
    19. UnityLoader.js:4 Creating WebGL 2.0 context.
    20. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Renderer: WebKit WebGL
    21.  
    22. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Vendor:   WebKit
    23.  
    24. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Version:  OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
    25.  
    26. faab3445-12d9-4ba3-85b8-e131493a5d28:8 GLES:     3
    27.  
    28. 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
    29.  
    30. faab3445-12d9-4ba3-85b8-e131493a5d28:8 OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level  <OpenGL ES 3.0> ; Context handle 16823152
    31.  
    32. faab3445-12d9-4ba3-85b8-e131493a5d28:8 UnloadTime: 0.050000 ms
    33.  
    34. faab3445-12d9-4ba3-85b8-e131493a5d28:8 Input Manager initialize...
    35.  
     
  3. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    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.
     
  4. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    Thanks for the ideas. It is only a UI, I will add a sprite to the scene and some logging, and see what happens.
     
  5. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    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.
     
  6. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    OK, so I now compiled for Android and also for PC. These have exactly the same problem.
    Am I missing something really fundamental here?

    It is running perfectly in the Unity IDE, it is only when I build it that it fails.
     
  7. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    UnderscoreA and dhunHERO like this.
  8. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    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.

    Thanks again for the help.
     
    dhunHERO likes this.
  9. keifp

    keifp

    Joined:
    Aug 5, 2021
    Posts:
    1
    So - what did you do from there? Same problem...not sure what to do next...lol
     
  10. LemonCasino

    LemonCasino

    Joined:
    Dec 15, 2021
    Posts:
    2
    so did what did you do to fix it?
    I am facing the same problem.
     
  11. LemonCasino

    LemonCasino

    Joined:
    Dec 15, 2021
    Posts:
    2
    did you find a solution for it?
    I am facing the same problem.
     
  12. marcfervil630

    marcfervil630

    Joined:
    Dec 12, 2019
    Posts:
    1
    I am having the same issue...
     
  13. MikeBastien

    MikeBastien

    Joined:
    Apr 24, 2009
    Posts:
    139
    Hi,

    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.

    1. Make sure the scene you are building is added and selected in the first slot.
    2. If it is not, with the scene open click the button indicated OR you can drag and drop it to this dialog as well.

    Good luck!

    2022-01-23_12h20_14.jpg
     
    Last edited: Jan 24, 2022