Skip to content

CVR Host Functions

TL;DR: ~95 hand-written host functions bound into the WASM CVR module name. Grouped by subsystem. Each table lists the import name, a brief purpose, and the access mask the binding enforces. When the Scope column is blank, the binding uses the 2-axis CheckAccess (Object + Owner).

  • Import module: CVR unless stated otherwise.
  • Signature shape is summarized; see the exact C# in CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/*Bindings.cs (and the shipped mirror at CVR-GameFiles/WasmScripting/*Bindings.cs) for parameter types.
  • Object column: Avatar / Prop / World / Any — which content types may call.
  • Owner column: Self / Other / Any.
  • Scope column: Self / ExternalContent / Any — only applies when the binding targets a specific wrapped object.
  • The shipped decompile (CVR-GameFiles/) lags the CCK source by a build or two. Where they disagree, the CCK source is the intended surface; import names flagged [new] are in the CCK bindings but not yet in the shipped decompile.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/PlayerBindings.cs. Read-only information about any player in the instance. CVR_Player_GetUserId still needs the world permission AccessUserIdentity; CVR_Player_GetUsername was released from the gate as of Preview.27-WASM.27.

FunctionPurposeObjectOwnerScope
CVR_Player_GetAllPlayersarray of all Player handles including localWorldAny
CVR_Player_GetRemotePlayersarray of remote-only handlesWorldAny
CVR_Player_GetUserIduser ID (string); redacted to Guid.Empty without AccessUserIdentityWorldAny
CVR_Player_GetUsernamedisplay name (string)WorldAny
CVR_Player_GetNetworkId16-bit network ID (for send addressing)WorldAny
CVR_Player_GetGameObjectroot GameObject handleWorldAny
CVR_Player_GetViewPointTransform at head positionWorldAny
CVR_Player_GetVoicePointTransform at mouth positionWorldAny
CVR_Player_GetInitialHeightinitial scaled height (m)WorldAny
CVR_Player_GetCurrentHeightcurrent scaled height (m)WorldAny
CVR_Player_GetGravitycurrent gravity vectorWorldAny
CVR_Player_SetOriginPositionteleport a player (not implemented)WorldAny
CVR_Player_SetOriginRotationrotate player origin (not implemented)WorldAny
CVR_Player_GetWornAvatarAvatar currently worn by this playerWorldAny
CVR_Player_GetSpawnedPropsarray of Prop handles this player spawnedWorldAny

[WIP] CVR_Player_SetOriginPosition and CVR_Player_SetOriginRotation both throw NotImplementedException in the current binding. Use CVR_LocalPlayer_SetPosition / SetRotation / SetPositionAndRotation for the local player only.

The shipped decompile (CVR-GameFiles/WasmScripting/PlayerBindings.cs) still exports the older property-style names (CVR_Player_UserId, CVR_Player_Username, CVR_Player_NetworkId, CVR_Player_GameObject, CVR_Player_ViewPoint, CVR_Player_VoicePoint, CVR_Player_Gravity) and implements CVR_Player_GetWornAvatar as return 0L. The CCK source replaces these with Get* names and a real AvatarDescriptor lookup. Expect one or two builds of mismatch during the property→method rename rollout; the CCK shim always points at the current host names.

Author-facing names: the CCK stub CCKStubs/PlayerCCK.cs exposes these bindings as player.GetUserId(), player.GetUsername(), player.GetNetworkId(), player.GetGameObject(), player.GetViewPoint(), player.GetVoicePoint(), player.GetWornAvatar(), player.GetSpawnedProps(), etc. Prefer the method form (makes marshalling cost obvious). See API Conventions.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/LocalPlayerBindings.cs. The local player. All setters modify your own client only. Getters have no access check; every setter calls CheckAccess(World, Any) so only world scripts can drive the local player. Reads fall through PlayerSetup.Instance / BetterBetterCharacterController.Instance; the SetPosition / SetVelocity / SetRotation / SetPositionAndRotation setters route through BetterBetterCharacterController.

FunctionPurposeObjectOwnerScope
CVR_LocalPlayer_PlayerObjectPlayer handle for selfanyany
CVR_LocalPlayer_GetPlaySpaceScaleVR play-space scaleanyany
CVR_LocalPlayer_GetPlaySpaceOffsetVR play-space offsetanyany
CVR_LocalPlayer_GetPositioncamera rig positionanyany
CVR_LocalPlayer_SetPositionteleport local playerWorldAny
CVR_LocalPlayer_GetVelocitycurrent rig velocityanyany
CVR_LocalPlayer_SetVelocityset rig velocity (e.g. impulse)WorldAny
CVR_LocalPlayer_GetRotationrig rotationanyany
CVR_LocalPlayer_SetRotationset rig rotationWorldAny
CVR_LocalPlayer_SetPositionAndRotation [new]atomic position + rotation + optional ground refreshWorldAny
CVR_LocalPlayer_SignalDiscontinuity [new]bump continuity version — avatar dynamics + remote interp skip interpolation on next tickWorldAny
CVR_LocalPlayer_OffsetByrelative offset — currently throws NotImplementedExceptionWorldAny
CVR_LocalPlayer_MoveTosmooth move-to — currently throws NotImplementedExceptionWorldAny
CVR_LocalPlayer_SetImmobilizeddisable locomotionWorldAny
CVR_LocalPlayer_IgnoreCollision [new]toggle Physics.IgnoreCollision against every player colliderWorldAnySelf
CVR_LocalPlayer_SetHeadHiddenCamera [new]head-hiding hook fires when the camera’s OnPreCull runsWorldAnySelf
CVR_LocalPlayer_Respawn [new]RootLogic.Instance.Respawn(true)WorldAny

Entries tagged [new] are in the CCK source (Preview.27-WASM.25 / .26) but not yet in the shipped decompile at CVR-GameFiles/WasmScripting/LocalPlayerBindings.cs. Guest calls to those names on older clients hit FillNonLinkedWithEmptyStubs and silently no-op.

Author-facing CCK stub: CCKStubs/LocalPlayerCCK.cs.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/AvatarBindings.cs. Both ObjectContexts are allowed — an avatar script can inspect its wearer’s avatar; a world script can inspect any avatar in the instance. The collision-exclude setters are world-only.

FunctionPurposeObjectOwnerScope
CVR_Avatar_GetAllAvatarsarray of currently worn avatarsanyany
CVR_Avatar_GetCurrentAvataravatar owning the calling VM (Avatar context)anyany
CVR_Avatar_GetWearerPlayer wearing an avataranyany
CVR_Avatar_GetNamedisplay name (Player.AvatarMetadata.AssetName)anyany
CVR_Avatar_GetContentIdCVR content ID (for identification)anyany
CVR_Avatar_GetRootObject [new]root GameObject handleanyany
CVR_Avatar_GetRootTransform [new]root Transform handleanyany
CVR_Avatar_SetCollisionExcludeLayers [new]set the LayerMask of layers the avatar’s colliders ignoreWorldAny
CVR_Avatar_GetCollisionExcludeLayers [new]read the current exclude maskanyany
CVR_Avatar_ResetCollisionExcludeLayers [new]clear the exclude maskWorldAny

Entries tagged [new] landed in the CCK source with Preview.27-WASM.27 (CVR.Avatar bindings live). The shipped decompile at CVR-GameFiles/WasmScripting/AvatarBindings.cs still contains empty stubs for the five original entries — on older clients, GetAllAvatars / GetCurrentAvatar / GetWearer / GetName / GetContentId do not return data.

Source: AvatarPointBindings.cs. Query named anchor points on an avatar (e.g. head, hand) in various reference frames.

FunctionPurposeObjectOwnerScope
CVR_AvatarPoint_GetPointTransformTransform for the named pointAnyAny
CVR_AvatarPoint_GetPointPositionworld-space positionAnyAny
CVR_AvatarPoint_GetLocalPointPositionlocal-space (avatar-rooted)AnyAny
CVR_AvatarPoint_GetRelativePointPositionrelative to another reference transformAnyAny
CVR_AvatarPoint_GetPointRotationworld-space rotationAnyAny
CVR_AvatarPoint_GetLocalPointRotationlocal-spaceAnyAny
CVR_AvatarPoint_GetRelativePointRotationrelativeAnyAny
CVR_AvatarPoint_GetPointForwardworld-space forward vectorAnyAny
CVR_AvatarPoint_GetPointRightworld-space right vectorAnyAny
CVR_AvatarPoint_GetPointUpworld-space up vectorAnyAny

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/WorldBindings.cs.

FunctionPurposeObjectOwnerScope
CVR_World_GetCurrentWorldWorld handle for the loaded worldanyany
CVR_World_GetNamedisplay nameanyany
CVR_World_GetContentIdCVR content IDanyany

All three are registered but have empty bodies in the current decompile and in the CCK source — calls compile and return without writing to the provided output pointers. Treat World.Name / World.ContentId / World.GetCurrentWorld() as forward-looking until a future preview fills in the implementations.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/PropBindings.cs. Spawned object (CCK CVRSpawnable).

FunctionPurposeObjectOwnerScope
CVR_Prop_GetAllPropsall spawned props in the instanceanyany
CVR_Prop_GetCurrentPropthe prop owning the calling VM (Prop context)anyany
CVR_Prop_GetSpawnerPlayer who spawned itanyany
CVR_Prop_GetName [new]display name (PropData.ContentMetadata.AssetName)anyany
CVR_Prop_GetContentIdCVR content IDanyany
CVR_Prop_GetRootObjectroot GameObjectanyany
CVR_Prop_GetRootTransform [new]root Transformanyany
CVR_Prop_Destroydespawn the propWorld | PropSelf
CVR_Prop_SetCollisionExcludeLayers [new]set the LayerMask of layers the prop’s colliders ignoreWorldAny
CVR_Prop_GetCollisionExcludeLayers [new]read the current exclude maskanyany
CVR_Prop_ResetCollisionExcludeLayers [new]clear the exclude maskWorldAny

The shipped decompile still exposes the old name CVR_Prop_GetTransform; the CCK source renamed this to CVR_Prop_GetRootTransform and added the GetName + collision-exclude-layers functions (Preview.27-WASM.23).

CVR_Prop_Destroy widened in Preview.27-WASM.27 from (World, Any) to (World | Prop, Self) — a prop script can now delete its own CVRSpawnable without going through the world VM.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/PortalBindings.cs. World portals between instances/worlds. Getters run with no access check; only the two mutators call CheckAccess(World, Any).

FunctionPurposeObjectOwnerScope
CVR_Portal_GetPositionworld-space positionanyany
CVR_Portal_GetRotationworld-space rotationanyany
CVR_Portal_SetPositionmove the portal (if unanchored)WorldAny
CVR_Portal_SetRotationrotate the portalWorldAny
CVR_Portal_IsAnchoredis the portal stuck to a surfaceanyany
CVR_Portal_GetSpawnerPlayer who dropped itanyany
CVR_Portal_GetRootObjectroot GameObjectanyany
CVR_Portal_GetTransformroot Transformanyany

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/NetworkingBindings.cs. No CheckAccess call on any binding; every ObjectContext can send and receive. See Networking for details.

FunctionPurposeObjectOwnerScope
CVR_Networking_SendMessagesend bytes to one or more players (SendType = Unreliable/UnreliableSequenced/Reliable)anyany
CVR_Networking_WillMessageBeDroppedreturns 1 if queuedBytes + size > 65536 (64 KB queue limit)anyany
CVR_Networking_NetworkCloggedPercentagebytesSent / 16384 as a float — fraction of the spike budget currently in flightanyany
CVR_Networking_GetInstanceOwnerPlayer handle of the authoritative owneranyany
CVR_Networking_GetPingNetworkManager.Instance.GameNetworkPinganyany
CVR_Networking_GetServerStartTime [new]Unix timestamp (ms) when the game server startedanyany
CVR_Networking_GetServerUptime [new]Game server uptime in msanyany

Receive side: the host dispatches incoming payloads by calling the guest export CVR_Networking_OnReceiveMessage(senderHandle, msgPtr, msgLen) on every message addressed to the local client (WasmVM.CallOnReceiveMessage, WasmNetworkManager.OnReceiveMessage). The guest-side shim surfaces this as the Networking.OnReceiveMessage delegate.

Budget constants (from CVR-GameFiles/WasmScripting/WasmNetworkManager.cs):

ConstantValueMeaning
MaxBytesPerSecond4096Sustained send budget, drained per second of wall clock.
MaxBytesSendSpike16384Instantaneous cap on in-flight bytes. A message may go over the sustained rate if the spike budget allows, and is held in the queue until it fits.
MaxBytesQueued65536Total bytes allowed in the send queue. WillMessageBeDropped returns true when adding the proposed size would cross this.

Source: FileStorageLinks.cs. World-only. Requires the FileStorageApiAllowed world permission. See File Storage.

FunctionPurposeObjectOwnerScope
FileStorage_ReadInternal_Fullread whole fileWorldAny
FileStorage_ReadInternal_Partialread rangeWorldAny
FileStorage_WriteInternal_Fulloverwrite fileWorldAny
FileStorage_WriteInternal_Partialpartial writeWorldAny
FileStorage_DeleteFileInternaldelete fileWorldAny
FileStorage_RenameFileInternalrename within this worldWorldAny
FileStorage_FileExistsInternalexistence probeWorldAny
FileStorage_GetFilesInternallist filenamesWorldAny
FileStorage_GetFileSizeInternalsize in bytesWorldAny
FileStorage_GetTotalSizeInternaltotal used bytesWorldAny
FileStorage_GetTotalCapacityInternalcurrent quota limitWorldAny

The guest-facing shim WasmScripting.FileStorage (CCKStubs/FileStorageCCK.cs) does not wrap the bindings with permission-helper methods — call WorldPermissions.Request(new WorldPermissions { FileStorageApiAllowed = true, ... }) yourself, then check WorldPermissions.CurrentPermissions.FileStorageApiAllowed before calling ReadFile / WriteFile / etc. The earlier CanUseFileStorage() / RequestUseFileStorage() helpers were removed in Preview.27-WASM.25.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/UtilBindings.cs.

FunctionPurposeObjectOwnerScope
CVR_Proxies_IsDestroyedreturns 1 if the wrapped object no longer existsanyany
CVR_Utils_GetEpochTimemonotonic tick counter from WasmManager.EpochTime (100 kHz)anyany
CVR_Utils_AddWasmBehaviourattach a WasmBehaviour at runtime and call its LateInitializeWorldAnySelf

CVR_Utils_AddWasmBehaviour enforces Scope=Self: you can only attach behaviours to objects inside your own content root.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/WasmUtilsBindings.cs. Exposes the host’s own CVRScriptScopeContext / CVRScriptOwnerContext evaluation so scripts can branch on permission outcome before calling a scope-gated API. No CheckAccess.

FunctionPurposeObjectOwnerScope
CVR_WasmUtils_GetScopeContextreturns the scope flag for a wrapped handle (None / Self / ExternalContent)anyany
CVR_WasmUtils_GetOwnerContextreturns the owner flag for this VM (None / Self / Other)anyany

The shim adds a third helper, WasmUtils.GetObjectContext(), that reads the value set at VM construction (CVRScriptObjectContext.Avatar / Prop / World). It is returned guest-side without a host call.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/WorldSettingsBindings.cs. Local-only toggles that drive CVR’s own visibility managers. Both setters call CheckAccess(World, Any).

FunctionPurposeObjectOwnerScope
CVR_WorldSettings_SetPropVisibilitySpawnableManager.SetSpawnableVisibility(v) — hides remote props + blocks local spawningWorldAny
CVR_WorldSettings_SetPlayerVisibilityCVRPlayerManager.Instance.SetRemotePlayerVisibility(v) — hides remote players + mutes voice for the local userWorldAny

Both entries are in the CCK bindings source but not in the shipped CVR-GameFiles/WasmScripting/ decompile — on a client without them, the imports are stubbed to no-op.

Source: CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/PermissionsBindings.cs. See World Permissions.

FunctionPurposeObjectOwnerScope
WorldPermissions_RequestPermissionsmarshals a WorldPermissionsMarshalStruct from guest memory and opens the CVR permission promptWorldAny

Source: CVR-GameFiles/WasmBinder.LinksManual.UnityEngine/. These aren’t CVR_* but worth listing alongside — they augment/override the generated UnityEngine bindings.

FileCovers
ObjectLinksManual.csObject.op_Equality, GetHashCode, Equals, ToString, 11 Instantiate overloads (all check World, Any, Self), Destroy, DestroyImmediate (both World, Any, Self)
DebugLinksManual.csdebug_log / debug_logWarning / debug_logError / debug_logException — all imported from module unity, not UnityEngine. Debug.LogException routes to Debug.LogError with the message
GameObjectLinksManual.csAddComponent, GetComponent with type routing
GraphicsBufferLinksManual.csGraphicsBuffer marshaling

Any call through UnityEngine / TMPro / UnityEngine.AI / Audio / Rendering / UI / SceneManagement goes through a generated binding — see UnityEngine Surface. Anything not in either table is either stubbed (safe no-op) or rejected at CCKWasmModule compile time.

  • CVR.CCK.Wasm/Scripting/Links/APIs/Bindings/*.cs — current CCK-side host binding implementations.
  • CVR-GameFiles/WasmScripting/*Bindings.cs — shipped counterpart (usually one or two builds behind).
  • CVR-GameFiles/WasmScripting/BindingManager.cs — registration order.
  • CVR-GameFiles/WasmScripting/WasmNetworkManager.cs — networking budget constants + send/receive paths.
  • CVR-GameFiles/WasmBinder.LinksManual.UnityEngine/*.cs — manual UnityEngine override bindings.