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

WebGL game won't load on Unity Play (Unity Version 2021.2 Beta)

Discussion in 'WebGL' started by Unitiblis, Sep 28, 2021.

  1. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Hi there,
    I tried to upload a prototype to Unity Play, but it won't load for the following reason:
    "Unable to load file https://play-static.unity.com/20210928/webgl/9bcee48a-a50b-4d06-b8ba-13f7e38fa479/Build/! Check that the file exists on the remote server. (also check browser Console and Devtools Network tab to debug)"

    The upload can be found at: https://play.unity.com/mg/other/uplayfirstattempt

    The same build works fine on itch.io. I guess Unity Play is not using the index.html but tries to access the Build directly? Did something change in 2021.2 which makes it so tha Unity Play is not able to load the build correctly? The needed data fies are there if I directly access them with the browser. It just seems that Unity Play can't find the correc file names, so that it tries to access the Build-folder instead of a file in the build folder?
     
    Last edited: Sep 28, 2021
  2. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    I had a look at the config.json that seems to get added to the Build, and saw that dataUrl/frameworkUrl/codeUrl were not set. I created my own config.json, referencing the correct uris, and reuploaded it.

    Now I get a new error message
    "Uncaught ReferenceError: UnityLoader is not defined"

    After having a look at https://forum.unity.com/threads/cha...-templates-introduced-in-unity-2020-1.817698/ it looks to me as if UnityPlay is searching for the older way of loading the game. But the new way was introduced with 2020.1, so I guess UnityPlay should be compatible with it?
    I might miss something obvious, so sorry if that's the case.
     
  3. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Tried it now with 2020.3.19 (LTS), and I get the same error(s)
     
  4. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Getting closer....so the initial issue had to do with 'wrong' settings: I did build with 'filenames as hashes' and compression. After this did not work, I disabled both. But it looks like the 'new' Loader introduced with 2020.1 needs compression enabled.
    When enabling compression again, but not enabling 'filenames as hashes' I got it working with v2020. But rebuilding with 2021.2 prompts me with yet another error message:
    Uncaught DOMException: Document.querySelector: '##canvas' is not a valid selector
     
    Last edited: Sep 28, 2021
  5. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Just another progress update for anybody else who might stumble over this issue: I filed a bug report now. I played around with the build.framework.js and escaped the second '#' (something like replacing '##canvas' with '#\#canvas').
    This way, I got the build running on Unity Play. But it is probably not the best solution...hence the bug report.
     
  6. ShinobiRex

    ShinobiRex

    Joined:
    Mar 10, 2022
    Posts:
    1
    Hi! was this ever resolved for you? I am currently working my way through the Unity Learn courses and am seeing some similar messages in dev tools whenever I try to play a game that I've published--it'll get to 90% and then just stop on these errors.
     

    Attached Files:

  7. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
  8. xaldin-76

    xaldin-76

    Joined:
    Oct 1, 2016
    Posts:
    24