Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to export to WebGL with Unity 6 #75

Closed
tarragonfly opened this issue Nov 21, 2024 · 2 comments
Closed

Unable to export to WebGL with Unity 6 #75

tarragonfly opened this issue Nov 21, 2024 · 2 comments

Comments

@tarragonfly
Copy link

tarragonfly commented Nov 21, 2024

Unity 6 released a while ago and is considered an LTS release by the new Unity release standards but WebGL export is currently non-functional when trying to export Rive getting-started example project from here: https://github.com/rive-app/rive-unity-examples/tree/main/getting-started

Unity: 6000.0.26f1
Rive runtimes: 2.1.0

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
wasm-ld: error: Library/PackageCache/app.rive.rive-unity/Runtime/Libraries/WebGL/librive_wasm.a(artboard.o): undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
emcc: error: 'C:/GameDev/6000.0.26f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/llvm\wasm-ld.exe @C:\Users\gdev\AppData\Local\Temp\emscripten_7f06ey06.rsp.utf-8' failed (returned 1)

UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
@damzobridge
Copy link
Contributor

Hmm, it seems like something changed with Emscripten in Unity 6. We're looking into it.

rive-engineering pushed a commit that referenced this issue Jan 7, 2025
This PR addresses [this reported issue](#75) that prevents WebGL builds with Rive from working in Unity 6. This is happening because Unity [updated their Emscripten version](https://docs.unity3d.com/6000.0/Documentation/Manual/webgl-native-plugins-with-emscripten.html) in Unity 6, requiring libraries to be built with the newer version.

The main challenge is that the new version (`Emscripten 3.1.38-unity`) isn’t backwards-compatible, which breaks Rive in older Unity versions. To address this, we now build two separate WebGL libraries to support both the new and old Emscripten versions.

Another challenge is that Unity doesn’t easily allow conditionally including native plugins based on Unity or Emscripten versions. To work around this, I'm conditionally including the appropriate library at build time.

Diffs=
e01747467b fix: unity 6 webGL compilation and build issue (#8828)

Co-authored-by: Adam <[email protected]>
@damzobridge
Copy link
Contributor

This should be resolved as of v0.3.2. Please let us know if that doesn't address it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants