Gd
The user-facing engine-glue facade. Holds object construction (Gd.create) and logging (Gd.print / Gd.printError / Gd.printWarning) — the one short handle game code reaches for. (The old Gd[T] smart-pointer TYPE is gone: an engine object is now held as its plain wrapper type, e.g. Node2D, and lifetime methods live directly on it.)
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Gd.type
Members list
Type members
Classlikes
Routes log/diagnostic output into Godot's own Output and error consoles.
Routes log/diagnostic output into Godot's own Output and error consoles.
- print uses the engine
printutility — text lands in the editor Output panel / stdout, like GDScript'sprint(). - printError / printWarning use the GDExtension
print_error/print_warningcalls (error console, with source tag).
Safe to call before the interface is loaded (Godot.interface): they fall back to stdout/stderr so early-init messages are never lost.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Printing.type
Value members
Concrete methods
Construct a brand-new engine object of class T. A reference-counted object (a Resource, a RefCounted) comes back owning its first reference: release it with unref(), or create it inside scoped. If parent is given, the new node is added as its child. Works for engine and user classes.
Construct a brand-new engine object of class T. A reference-counted object (a Resource, a RefCounted) comes back owning its first reference: release it with unref(), or create it inside scoped. If parent is given, the new node is added as its child. Works for engine and user classes.
Attributes
Run body, then release every RefCounted reference adopted inside it (engine methods returning a Ref<T>, such as ResourceLoader.load or Resource.duplicate, and Gd.create of a RefCounted class) that was not kept with keep(). Released even if body throws. Blocks nest; a reference belongs to the innermost one.
Run body, then release every RefCounted reference adopted inside it (engine methods returning a Ref<T>, such as ResourceLoader.load or Resource.duplicate, and Gd.create of a RefCounted class) that was not kept with keep(). Released even if body throws. Blocks nest; a reference belongs to the innermost one.
Gd.scoped {
val tex = ResourceLoader.singleton.load(path, "", 0L)
sprite.setTexture(tex) // the sprite takes its own reference
} // ours is released here
Attributes
Wrap a raw engine-object handle (a gdext.internal.engine.GodotObject, e.g. one read from a Variant) as the typed wrapper T. Generated engine methods already return typed wrappers. Identity-preserving (one wrapper per engine object). Returns a null T for a null handle.
Wrap a raw engine-object handle (a gdext.internal.engine.GodotObject, e.g. one read from a Variant) as the typed wrapper T. Generated engine methods already return typed wrappers. Identity-preserving (one wrapper per engine object). Returns a null T for a null handle.