Examples
TL;DR: Six self-contained scripts showing the common shapes of a CVR WASM script, plus context packs (avatar, prop, world) and UdonSharp ports for creators coming from VRChat. Each page lists the GameObjects/components you need, the script code, and extension ideas. All source files live under examples/ at the repo root, alongside these pages.
How to use
Section titled “How to use”- In your Unity CCK Wasm project, add a
CCKWasmProjectDescriptorto your content root (avatar, prop, or world root). - Copy the corresponding
examples/0N_*.csfile into your project’sAssets/folder. - Either drop the component onto a child GameObject or add the
MonoScriptto the descriptor’sincludedScriptslist. - Wire any serialized references (TMP text, buttons, transforms, checkpoint array) in the inspector.
- Build via the CCK — the pipeline picks up the script, compiles it into
Assets/WasmModule.wasm, and binds it at runtime.
The examples
Section titled “The examples”| # | Example | Context | Demonstrates |
|---|---|---|---|
| 01 | Hello World | any | Start, Update, OnDestroy, Debug.Log, Time.time, simple serialization |
| 02 | Click Counter | world | Button.onClick rewiring, TextMeshProUGUI, persistent state across play sessions |
| 03 | Timed Animator | any | Update-driven transform animation, runtime control methods, [WasmSerialized] private fields |
| 04 | Racing System with Laps | world | Multi-script architecture, OnTriggerEnter, LocalPlayer, lap validation, HUD |
| 05 | File-Storage Notepad | world | WorldPermissions.Request, FileStorage API, TMP_InputField, graceful degradation |
| 06 | Networked Counter | world | Networking.SendMessage + OnReceiveMessage, BufferReaderWriter, owner-authoritative pattern, OnInstanceOwnerChange handoff |
Context packs
Section titled “Context packs”Small scripts grouped by the CCK content descriptor they target: Avatar · Prop · World.
UdonSharp ports
Section titled “UdonSharp ports”Ports index — five community packages (AAChair, OpenFlight, HnFClimbing, PlayerPicker, UdonChat) and six VRChat docs snippets converted side-by-side to CVR WASM, with notes on what translates and what doesn’t.
Before you build
Section titled “Before you build”- Ensure the
CVR.CCK.Wasmpackage is imported. - First build triggers download of the .NET SDK + WASI SDK + CCK WasmModule (~300 MB, cached to
%LOCALAPPDATA%/ChilloutVR/CVRBuildTools/). Subsequent builds are fast. - All examples adhere to the Permissions model. Copy-pasting a world example into an avatar content root will throw at runtime on the first gated call.
Related
Section titled “Related”- Authoring — the underlying workflow.
- Events — which method names the build processor scans for.
- API Overview — where to find the types used by each example.