Search Unity

Problem with relative URLs when using WASM

Discussion in 'WebGL' started by amateurd, Oct 10, 2019.

  1. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    23
    I like to have 2 games available from the same index.html file, selected by script. The hierarchy is like this:
    index.html
    /game1/Build/game.json,game.unityweb,game.wasm etc
    /game2/Build/game.json,game.unityweb,game.wasm etc

    This works fine by adapting the src of the script locations and the location of the json file.

    However, if WASM is enabled, the WASM fetch is hard-coded to the "Build/" folder off the root, and can't be changed. I even tried editing the JSON but it didn't work.

    All the other files respect the relative paths. Just the WASM file returns 404 not found error.

    Any ideas for a workaround would be welcome, but I specifically don't want to have more than one index.html hence the scripting.

    Thanks
     
  2. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    321
    You can override it: https://forum.unity.com/posts/4889747/

    We do basically the same thing but for different reasons...desktop users get build X (MSAA On), mobile users get build Y (MSAA Off).
     
    amateurd likes this.
  3. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    23
    I really don't know why they didn't just support relative paths like, well, everything on the Internet.

    Thanks for saving me a ton of time, have a great weekend.