Variables Reference
Actions, conditions and expressions to handle variables, from simple variables like the player score, the number of remaining lives to complex variables containing arbitrary data like an inventory or the result of a web request. Read more explanations about it.
Actions
Clear children
Remove all the children from the structure or array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Structure or array variable
Add value to array variable
Adds a boolean at the end of an array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1 (❓ True or False): Boolean to add
Add value to array variable
Adds a number at the end of an array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1 (🔢 Number): Number to add
Add value to array variable
Adds a text (string) at the end of a array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1 (string): Text to add
Add existing variable
Adds an existing variable at the end of an array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1 (🗄️ Any variable): Variable with the content to add The content of the variable will be copied and added at the end of the array.
Remove variable by index
Removes a variable at the specified index of an array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1 (🔢 Number): Index to remove
Remove a child
Remove a child from a structure variable.
See parameters
- Parameter 0 (🗄️ Any variable): Structure variable
- Parameter 1 (string): Child's name
Change variable value
Modify the boolean value of a variable.
See parameters
- Parameter 0 (variableOrProperty): Variable
- Parameter 1: 🟰 Operator
Technical note: parameter 2 are internal parameters handled by GDevelop.
Change variable value
Modify the number value of a variable.
See parameters
- Parameter 0 (variableOrProperty): Variable
- Parameter 1: 🟰 Operator
- Parameter 2 (🔢 Number): Value
Change variable value
Modify the text (string) of a variable.
See parameters
- Parameter 0 (variableOrProperty): Variable
- Parameter 1: 🟰 Operator
- Parameter 2 (string): Value
Conditions
Variable value
Compare the boolean value of a variable.
See parameters
- Parameter 0 (variableOrPropertyOrParameter): Variable
- Parameter 1 (❓ True or False): Check if the value is
Technical note: parameter 2 are internal parameters handled by GDevelop.
Variable value
Compare the number value of a variable.
See parameters
- Parameter 0 (variableOrPropertyOrParameter): Variable
- Parameter 1: 🟰 Relational operator
- Parameter 2 (🔢 Number): Value to compare
Variable value
Compare the text (string) of a variable.
See parameters
- Parameter 0 (variableOrPropertyOrParameter): Variable
- Parameter 1: 🟰 Relational operator
- Parameter 2 (string): Value to compare
Number of children
Compare the number of children in an array variable.
See parameters
- Parameter 0 (🗄️ Any variable): Array variable
- Parameter 1: 🟰 Relational operator
- Parameter 2 (🔢 Number): Value to compare
Child existence
Check if the specified child of the structure variable exists.
See parameters
- Parameter 0: 🗄️ Any variable
- Parameter 1 (string): Name of the child
Expressions
Expression | Description | |
---|---|---|
VariableChildCount(variable) |
Number of children in a scene array or structure variable | |
🗄️ Any variable | Array or structure variable | |
VariableFirstNumber(variable) |
Get the value of the first element of an array variable, if it is a number. | |
🗄️ Any variable | Array variable | |
VariableFirstString(variable) |
Get the value of the first element of an array variable, if it is a text (string). | |
🗄️ Any variable | Array variable | |
VariableLastNumber(variable) |
Get the value of the last element of an array variable, if it is a number. | |
🗄️ Any variable | Array variable | |
VariableLastString(variable) |
Get the value of the last element of an array variable, if it is a text (string). | |
🗄️ Any variable | Array variable |
The Variables extension is always installed in all GDevelop projects: there is no need to add it from the Project Manager.
This page is an auto-generated reference page about the Variables feature of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop features here.