Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Preview 0.15.3 -- Wasm Builds Won't Run on Safari

Discussion in 'Project Tiny' started by yossi_horowitz_artie, Jun 19, 2019.

  1. yossi_horowitz_artie

    yossi_horowitz_artie

    Joined:
    Jan 30, 2019
    Posts:
    87
    WebAssembly builds in made in preview 0.15.3 of Project Tiny don't appear to run in Safari.

    This is because in the codeblock from `postamble_minimal.js` embedded into the built application by the version of Emscripten which this version of Tiny uses, there's a usage of the javascript function `WebAssembly.instantiateStreaming()` which is not supported by Safari.

    A workaround for this that seems to be working for the moment is to add a line `linkflags["STREAMING_WASM_COMPILATION"] = "0";` to the file `TinyEmscripten.cs` in the Package folder before the line `e = e.WithEmscriptenSettings(linkflags);`

    This will cause `WebAssembly.instantiate()` to be used instead. However, it would be nice to be able to use `WebAssembly.instantiateStreaming()` on platforms where it's supported and fall back to `WebAssembly.instantiate()` only where needed, and I believe that the implementation of `postamble_minimal.js` more recent versions of Emscripten do just that -- so hopefully Unity will upgrade its Emscripten version in its next Tiny release. :)