Skip to main content

Variables

Variables can declared using the standard C# notation of type_name variableName (= initializing_expression)?

Just like C#, a variable's lifespan is the block it is declared in and its value is re-evaluated every frame.

Not initializing a variable will implicit assign it to default.


template VariableSample render {

float a = 10f;
float x;
Color r = Color.red;
var g = Color.green;

}

State

A state variable will be initialized once and then its value will be remembered every frame until its parent scope is destroyed.

template StateSample render {

state float a = 10f;
state float x;
state Color r = Color.red;
state var g = Color.green;

}