Structs in GDScript
The _init
function constructs a new person instance with the given name.
You can create a new instance of a Person
.
You can name the fields when initializing an instance.
GDScript does not support anonymous structs, but you can use Dictionaries for similar purposes.
To run this script, attach it to a Node in your Godot project and run the scene.
Next example: Methods