Dynamic WASM Asset
DynamicWasmAsset
is an implementation of IWasmAsset
which allows loading of arbitrary data as WASM/WAT code at runtime. Read more about runtime loading of WASM.
Properties​
CacheKey
​
If non-null the Module
s loaded from this asset will be cached with this key. Any later loads from an asset with the same CacheKey & EngineConfig
will load the same module.
Creating multiple DynamicWasmAsset
s with the same CacheKey
but different WASM/WAT code will lead to unpredictable behaviour!
Static Methods​
FromWASM(string name, byte[] bytes, string? cacheKey = null)
​
Create a new DynamicWasAsset
from the given WASM bytes. The name
sets the Name
of the Module
created from this asset.
FromWAT(string name, string wat, string? cacheKey = null)
​
Create a new DynamicWasAsset
from the given WAT text. The name
sets the Name
of the Module
created from this asset.
FromPathWASM(string name, string path, string? cacheKey = null)
​
Invoke FromWASM
with all of the bytes from the file at the given path.
FromPathWAT(string name, string wat, string? cacheKey = null)
​
Invoke FromWAT
with all of the text from the file at the given path.