ParelVRDocs
Player site

Scripting / Reference

Events

Every event a VoltBehaviour can receive. Declare a method with the same name and parameters and Volt calls it. 50 events in API 1.6.

Event Parameters When it runs
OnStart — Called once, before the first OnUpdate, when the behaviour first becomes active.
OnUpdate — Called every frame.
OnLateUpdate — Called every frame after every OnUpdate.
OnFixedUpdate — Called on every physics step.
OnEnabled — Called when the behaviour becomes active.
OnDisabled — Called when the behaviour stops being active.
OnDestroyed — Called when the object is destroyed or the world unloads.
OnInteract — The local player used this object. Needs a VoltInteractable or a collider on the object.
OnPickup — The local player picked this object up. Needs a VoltPickup on the object.
OnDrop — The local player let go of this object.
OnPickupUseDown — The local player pressed Use while holding this object.
OnPickupUseUp — The local player released Use while holding this object.
OnHoverEnter — The local player started pointing at this object, or looking at it within reach on desktop.
OnHoverExit — The local player stopped pointing at this object.
OnPlayerJoined VoltPlayer player A player joined the instance. Also called once for every player already present when the world loads.
OnPlayerLeft VoltPlayer player A player left the instance.
OnPlayerRespawned VoltPlayer player A player was moved back to a spawn point.
OnStationEntered VoltPlayer player A player sat down in the VoltStation on this object.
OnStationExited VoltPlayer player A player left the VoltStation on this object.
OnPlayerReady VoltPlayer player A player has loaded the world and caught up with it: synced fields, owners and late-joiner events have arrived. On the other players it means network events sent to this player now reach them (OnPlayerJoined comes while they may still be loading); for the local player it comes once, when this client is caught up. The place to send a late joiner anything it needs that is not already synced.
OnOwnershipTransferred VoltPlayer newOwner Ownership of this object moved to another player.
OnOwnershipRequest VoltPlayer requester, VoltPlayer newOwner Someone asks for ownership. Runs on the current owner; return false to refuse.
OnPreSerialization — Called on the owner just before the synced fields are sent.
OnDeserialization — Called after synced fields were received from the owner.
OnPostSerialization bool success, int byteCount Called on the owner after the synced fields were sent, with the result and the size in bytes.
OnMasterChanged VoltPlayer newMaster The instance master changed.
OnEnterTrigger VoltCollider other A collider entered a trigger collider on this object.
OnExitTrigger VoltCollider other A collider left a trigger collider on this object.
OnStayTrigger VoltCollider other A collider is inside a trigger collider on this object. Called on every physics step.
OnEnterCollision VoltCollision collision Something hit a collider on this object.
OnExitCollision VoltCollision collision Something stopped touching a collider on this object.
OnPlayerEnterTrigger VoltPlayer player A player entered a trigger collider on this object.
OnPlayerExitTrigger VoltPlayer player A player left a trigger collider on this object.
OnPlayerStayTrigger VoltPlayer player A player is inside a trigger collider on this object. Called on every physics step.
OnPlayerEnterCollision VoltPlayer player A player bumped into a collider on this object.
OnPlayerExitCollision VoltPlayer player A player stopped touching a collider on this object.
OnWebResponse VoltWebRequest request A web request this behaviour started has finished.
OnStorageResult VoltStorageRequest request A storage request this behaviour started has finished.
OnVideoReady VoltVideoPlayer player A video is loaded and ready to play.
OnVideoStarted VoltVideoPlayer player A video started playing.
OnVideoPaused VoltVideoPlayer player A video was paused.
OnVideoEnded VoltVideoPlayer player A video reached its end.
OnVideoError VoltVideoPlayer player, string reason A video could not be loaded or played.
OnInputAction VoltInputAction action, bool pressed The local player pressed or released an input action.
OnDialogResult int dialogId, bool confirmed The local player answered a dialog this script opened with VoltDialogs.ShowDialog.
OnPurchaseCompleted string productId, bool success A purchase the local player started in this world went through or failed.
OnWorldMenuButton string id The local player pressed a button of the world's menu.
OnWorldMenuToggle string id, bool on The local player switched a toggle of the world's menu.
OnWorldMenuSlider string id, float value The local player moved a slider of the world's menu (while they drag it, too).
OnWorldMenuOption string id, int index The local player picked a choice of an option switcher of the world's menu.