Scripting / Reference
Core
Types in the ParelVR.Volt namespace.
VoltBehaviour#
ParelVR.Volt.VoltBehaviour behaviour
Base class of every world script. A class that derives from it is compiled by the VoltCS compiler into Volt bytecode and run by VoltVM inside ParelVR; Unity never runs its code. Override the On... methods to receive events, and mark fields with VoltSynced to share them with other players.
VoltBehaviour properties#
True when the local player owns this object.
The player who owns this object.
Whether this behaviour receives events. A disabled behaviour still keeps its state.
The object this behaviour is attached to.
The name of the object this behaviour is attached to.
The transform of the object this behaviour is attached to.
VoltBehaviour methods#
Finds a component, or another behaviour, on this object or any of its children.
Finds a component, or another behaviour, on this object or any of its parents.
Finds a component, or another behaviour, on the same object. Returns null when there is none.
Reads a public or VoltExpose field of this behaviour by name. Returns null when there is no such field.
Asks for this behaviour's synced fields to be sent to everyone. Only the owner's request has an effect.
Calls a public or VoltEvent method of this behaviour by name. Does nothing when there is no such method.
Calls a method by name after a number of frames.
Calls a method by name after a delay in seconds.
Runs a VoltNetworkEvent method of this behaviour on other players' clients. The method name must be a constant (use nameof); the compiler turns it into a numeric id. Up to eight arguments of syncable types.
Runs a VoltNetworkEvent method of this behaviour on one player's client.
What SendNetworkEvent compiles to: the event is named by its id.
What SendNetworkEvent to one player compiles to: the event is named by its id.
Hands this object to another player. Only the current owner or the instance master can do this.
Writes a public or VoltExpose field of this behaviour by name. Returns false when the field is missing or the value has the wrong type.
Starts a coroutine. It runs until its first yield before this call returns.
Stops every coroutine this behaviour started.
Stops a coroutine this behaviour started.
Makes the local player the owner of this object. OnOwnershipRequest of the current owner can refuse.
VoltCoroutine#
ParelVR.Volt.VoltCoroutine class
A running coroutine. Coroutines are state machines inside VoltVM: they never run on another thread, and a world can have at most 512 of them at a time.
VoltCoroutine properties#
True once the coroutine ran to its end.
True while the coroutine has not finished and was not stopped.
VoltCoroutine methods#
Starts a coroutine on a behaviour. The same as calling StartCoroutine on it.
Stops the coroutine. It does not continue after its current yield.
Stops every coroutine of a behaviour.
VoltDebug#
ParelVR.Volt.VoltDebug static
Messages for the creator. They go to the Volt Console in the editor and to the world log in ParelVR.
VoltDebug methods#
Writes an error when a condition is false.
Writes a message.
Writes an error. The script keeps running.
Writes a warning.
VoltError#
ParelVR.Volt.VoltError enum
Why a web request, a storage request or a purchase did not succeed.
| Value | Meaning |
|---|---|
None (0) |
|
InvalidArgument (1) |
The address or the key is not well formed. |
NotPermitted (2) |
The world is not allowed to do this, or the player has switched it off. |
DomainNotAllowed (3) |
The address is not on the world's list of allowed domains. |
RateLimited (4) |
Too many requests in a short time. |
TooLarge (5) |
The request or the answer is larger than the limit. |
Timeout (6) |
No answer arrived in time. |
NetworkError (7) |
The connection failed. |
HttpError (8) |
The server answered with an error status. |
NotFound (9) |
There is no value for the key. |
Unavailable (10) |
The service is not available right now. |
VoltEvents#
ParelVR.Volt.VoltEvents static
A world-wide event bus: one call reaches every script without holding references to them.
VoltEvents methods#
Calls the public method with this name and no parameters on every enabled script of the world that has one, in the order the scripts were created. Only on this client; use SendNetworkEvent to reach others.
VoltProfiler#
ParelVR.Volt.VoltProfiler static
What the world's scripts cost, for scripts that want to adapt to it.
VoltProfiler properties#
Number of coroutines that are running.
Instructions every script of the world ran in the last frame.
Estimate of the memory the world's scripts hold, in bytes.
Milliseconds every script of the world took in the last frame.
VoltRandom#
ParelVR.Volt.VoltRandom static
Random numbers that are the same on every client. The result depends only on the seed and the index, so players who share a seed (a synced field, or VoltRandom.Hash of the instance id) draw the same values without sending them.
VoltRandom methods#
A seed made from text, the same on every client and every platform.
A number from min (inclusive) to max (exclusive) for the seed and index.
A whole number from min (inclusive) to max (exclusive) for the seed and index. min when max is not above min.
A number from 0 (inclusive) to 1 (exclusive) for the seed and index.
VoltRuntime#
ParelVR.Volt.VoltRuntime static
Facts about the runtime a script is running in.
VoltRuntime properties#
Version of the Volt API the runtime provides, such as "1.0".
Version of the bytecode format the runtime reads.
True when the script runs in the Unity editor's simulator instead of ParelVR.
Two-letter code of the player's language, such as "en" or "de". "en" when it is not known.
The platform ParelVR runs on: "windows" or "android".
VoltTime#
ParelVR.Volt.VoltTime static
Clocks.
VoltTime properties#
Seconds the last frame took.
Seconds between physics steps.
Frames since the world loaded.
Difference between this device's local time and UTC in minutes.
Real seconds since the world loaded, whatever the time scale.
Seconds since the world loaded.
Milliseconds since 1 January 1970 UTC, from this device's clock.
Seconds since 1 January 1970 UTC, from this device's clock.
VoltWait#
ParelVR.Volt.VoltWait static
The waits a coroutine can yield. Yielding null waits for the next frame.
VoltWait methods#
Waits until the end of the frame.
Waits for the next physics step.
Waits a number of frames.
Waits a number of real seconds, whatever the world's time scale.
Waits a number of seconds of world time.
Waits until a method of this behaviour returns true. Checked once per frame.
Waits while a method of this behaviour returns true. Checked once per frame.
VoltWaitInstruction#
ParelVR.Volt.VoltWaitInstruction class
What a coroutine yields to say when it wants to continue.
