Various languages that support output to WebAssembly such as Rust, Go, MoonBit and C/C++ can be used, allowing you to choose the language that best suits your needs.
WaaS supports the Component Model and allows you to perform practical bindings.
Without explicit permission, WebAssembly code cannot access the host environment's memory or functions. You can also run untrusted scripts safely.
WaaS is an interpreter fully implemented in C# and does not require JIT or AOT compilation of WebAssembly itself. It can run anywhere Unity or .NET supports including platforms where JIT is prohibited, such as iOS.
It can be used as a script to describe events and AI in a game. By creating scripts in small units, you can achieve fast hot reloads.
It can be used as a script to give complex behavior to user-created contents.
It can be used as a script to add plugins to applications created with Unity or .NET.
WaaS is an interpreter that runs on managed code. In Unity, installing com.unity.burst makes it use an interpreter loop compiled by Burst.
wasmtime is a JIT compiler and is shown for reference. xLua runs Lua 5.3 on a native interpreter, not LuaJIT. Results vary with the workload and the guest language. See the documentation for the values, the conditions and the results of MoonBit, and WaaS.Benchmarks to reproduce them.
Note
WaaS is currently very experimental and breaking changes can be made.
See the documentation for installation and usage.
Wukuro is an event scripting framework for Unity based on WaaS, developed in this repository. Events are written in Rust or MoonBit (or other languages through WIT) and run as WebAssembly components.
- Unity package:
WaaS.Unity/Packages/com.ruccho.wukuro - Rust crates:
Wukuro/crates(wukuro,wukuro-macro,wukuro-dialog) - MoonBit module:
Wukuro/moonbit/wukuro(ruccho/wukuro)
