SetVariable

Method

SetVariable has 2 overloads.

SetVariable(byte, object)

Same as but with an object type. Provided for convenience.

Definition

void SetVariable(byte id, object value)
void SetVariable(byte id, object value)

Parameters

ParameterDescription
byte id
object value

SetVariable<T>(byte, T)

Set the value of, or create a variable on the space object. Requires the local actor to have ownership of the object. Note that depending on the context, setting a variable may not be instantaneous but it will always be performed in the same frame.

Definition

void SetVariable<T>(byte id, T value)
void SetVariable<T>(byte id, T value)

Parameters

ParameterDescription
byte id

The id of the variable to set or create. It is recommended to use an enum of type byte to define variables.

T value

The value of the variable (supported types: int, bool, float, Vector2, Vector3, string, Color32, byte, double, long, int[])