Working with Godot types
Find child nodes, instantiate scenes, and update Godot values from JVM code.
Find a child node
For a scene with a child named Timer, the following code accesses it from _ready(). getNode returns a nullable node; cast it to the expected type.
Load a scene
This example loads a PackedScene named bullet.tscn, instantiates its Node2D root, and adds it as a child from a node method.
Value types are copies
Assign value types back
Value types such as Vector3 are copies when read from Godot properties. Changing the copy does not update the node.
This changes only a copy:
To update rotation, change the copy and assign it back to the property:
Kotlin's mutation helpers combine these steps and write the changed value back automatically. In Java and Scala, use the read-modify-write form above.
Collections share storage
VariantArray and Dictionary share their contents with Godot. Value-type elements still need read-modify-write: retrieve the element, change it, then assign it back to the same index or key.
Use your language's type checks for engine classes and your own scripts: is in Kotlin, instanceof in Java, and pattern matching in Scala.
Use a singleton
Engine singletons are accessed through their generated class. Global helpers are on godot.global.GD.