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

Build Error

Discussion in 'WebGL' started by GoodNight9, Apr 27, 2021.

  1. GoodNight9

    GoodNight9

    Joined:
    Dec 29, 2013
    Posts:
    123

    Hello! I keep getting this error when I try to build my webGL game. I don't really know what to try and I've spent the last 2 hours trying to google it but haven't had any luck :(

    Thank you for your time -

    https://ibb.co/jHRYQ9b
     
  2. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    276
    If you open it directly from Explorer, the URL will be file://~. Access to this URL is prohibited by the browser for security reasons.
    So, if you run Build & Run or set up a local web server to host the build folder and access it at http://localhost/~, you won't get this error.
     
    GoodNight9 likes this.
  3. GoodNight9

    GoodNight9

    Joined:
    Dec 29, 2013
    Posts:
    123
    Oh, OK, I think I understand the problem now. Though, I'm not very familiar with web terminology.
    What do you mean open it directly from explorer?
     
  4. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    276
    sorry. WIndows File Explorer (Finder on Mac).
     
    GoodNight9 likes this.
  5. GoodNight9

    GoodNight9

    Joined:
    Dec 29, 2013
    Posts:
    123
    Ahh! Ok, well, I think it was closer, but this is what happened :
     
  6. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    276
    Yes, I get that error when I open it from File Explorer. The browser prevents downloads at file://~ URL(c:/~) to prevent access to local files. (Download the build file with UnityLoader.js)Try clicking the "Build And Run" button. I think the URL will be http://~.
     
    Last edited: Apr 28, 2021
  7. GoodNight9

    GoodNight9

    Joined:
    Dec 29, 2013
    Posts:
    123
    OK, it works when I build and Run it! Screenshot here: https://ibb.co/mC7SXF4
    But, how do I share it so other people can just play it? And, is Unityloader.js like a package that I have to import?? Or, what exactly does that do, I'm very new to webgames so sorry if these questions sound dumb :(
     
  8. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    276
    GoodNight9 likes this.
  9. GoodNight9

    GoodNight9

    Joined:
    Dec 29, 2013
    Posts:
    123
    Thank you gtk2k You've helped a lot and I believe my questions have been answered very well :)
    Hope you have a wonderful day!!!