Basic MonoBehaviour
This scene demonstrates the most basic usage of Wasmbox. It is located in Assets\Plugins\PlaceholderSoftware\Wasmbox\Demos
.
The Demo Object
has a BasicMonoBehaviourDemoScript
attached. This uses the SimpleWasmMonoBehaviour
to load a WASM file into memory. Once the file is loaded it calls a function which doubles a number, the output is shown at the bottom of the screen.
- Open
AWatFile.wat
in a text editor, this is raw WebAssembly Text (WAT). - Inspect the
Demo Object
.AWatFile.wat
has been dropped into theWasm Asset
property.Engine Config
sets how the asset is compiled and run, this can usually be left at the default settings.
- Open
BasicMonoBehaviourDemoScript.cs
.SimpleWasmMonoBehaviour<AWatFile>
is used instead ofMonoBehaviour
.AWatFile
is the name of the autogenerated wrapper code (same name as the file by default).