Search Unity

Bug Unity WebGL Player - 2 bugs and one feature request [Unity 2019.1 and higher]

Discussion in 'Web' started by AntySK, May 25, 2020.

  1. AntySK

    AntySK

    Joined:
    Aug 30, 2013
    Posts:
    33
    Hi,
    on our website, we have Unity WebGL player separated from game files (Build). They are stored on CDN. In version Unity 2019.1 and higher I noticed two problems.

    1. wasmCodeUrl - it is not possible to put absolute url for wasmCodeUrl. Every time I have to modify JS file (function locateFile) to make it work. This is not a problem for dataUrl or wasmFrameworkUrl.

    2. Because of browser cache, we add query string after file name in JSON. For example game.unityweb?v1. If I do a build without wasm streaming and add query string, I will get an error:
    Code (CSharp):
    1. wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
    For some reason, Unity thinks it is wasm file, even if it is not. The game is working without any problems, because it switch to array buffer. But would be great to fix/remove this error message in browser console.

    Plus one feature request:
    - would be great to add Streaming Assets url to JSON. It would be much easier to host Unity game with streaming assets on CDN and no need to modify JS file with own code.