Quickstart
TL;DR: Install the CCK Wasm package, add a CCKWasmProjectDescriptor to your content root, create a WasmBehaviour, log “Hello, world!”, build, and upload. If you’ve written a Unity script before, this takes under five minutes.
What you need
Section titled “What you need”- Unity version matching the CVR CCK.
- The
CVR.CCK.Wasmpackage imported into your project. - An internet connection on the first build — the pipeline downloads .NET SDK 10 preview + WASI SDK + the CCK WasmModule into
%LOCALAPPDATA%/ChilloutVR/CVRBuildTools/.
Status
Section titled “Status”C# WASM scripting is currently in closed (invite-only) testing. If you’re reading this from a published book, you’re either on the testing branch or documenting internally. The long-term plan is to replace CVR’s existing Lua scripting with this system.
Step 1 — Create the script
Section titled “Step 1 — Create the script”Unity menu: Assets > Create > CVR Wasm Behavior (C#).
Name the file HelloWorld.cs. You get:
using UnityEngine;using WasmScripting;
public partial class HelloWorld : WasmBehaviour{ void Start() { } void Update() { }}Three things to notice:
using WasmScripting;— the namespace containingWasmBehaviourand the serialization attributes.: WasmBehaviour— every WASM-authorable script inherits from this, notMonoBehaviourdirectly.partial— required. The serialization generator emits a companion partial at build time.
Step 2 — Say hello
Section titled “Step 2 — Say hello”Replace the body of Start():
using UnityEngine;using WasmScripting;
public partial class HelloWorld : WasmBehaviour{ void Start() { Debug.Log("Hello, world!"); }
void Update() { }}Debug.Log(string) is bound to CVR’s logging system. Strings go to the Unity console during Play Mode and to the CVR log in-game.
Step 3 — Attach to a GameObject
Section titled “Step 3 — Attach to a GameObject”- Drop a primitive in the scene —
GameObject > 3D Object > Cube. - Select it.
- In the inspector, click Add Component, search for
HelloWorld, and add it.
Step 4 — Wire a content descriptor
Section titled “Step 4 — Wire a content descriptor”Your root content GameObject (the avatar, prop, or world root) needs a CCKWasmProjectDescriptor.
- Select the content root.
- Add Component > ChilloutVR Editor > CCK Wasm Project Descriptor.
- Leave everything default. The build processor will find your
WasmBehaviourcomponents automatically.
If your HelloWorld GameObject isn’t already a child of the content root, make it one.
Step 5 — Build
Section titled “Step 5 — Build”- Use the normal CCK flow (for a prop, select the
CVRSpawnableand click Upload; for an avatar or world, the equivalent upload button). - On the first build, watch the Unity console for
Installing .NET SDKandInstalling WASI SDKprogress bars. It takes a few minutes once. - On subsequent builds the pipeline is cached and completes in a few seconds.
Output lands at Assets/WasmModule.wasm, and WasmVMAnchor is added to the content root pointing at it.
Step 6 — See the log
Section titled “Step 6 — See the log”When you join an instance with the built content, CVR loads the WASM module and dispatches Start. You should see:
Hello, world!in the client log (or the Unity console if you tested in Play Mode).
That’s it — you have a running WASM script.
What to read next
Section titled “What to read next”- Authoring — full workflow, serialization attributes, descriptor fields.
- Events — what else you can hook (
Update,OnPlayerJoined, triggers, etc.). - Permissions — why certain calls throw and how to structure code around the sandbox.
- Examples — progressive examples up to a full racing system.
- Performance — keep your script fast as it grows.
If something went wrong
Section titled “If something went wrong”See Troubleshooting for the common errors — the first-build download hang, error CS0103 on a type that looks imported, WasmAccessDeniedException, or a script that compiles but silently does nothing.