Top Level Namespace
Included Modules
Extended Modules
Defined in:
Method Summary
-
crystal_godot_init(api : Pointer(Godot::LibBridge::BridgeAPI)) : Void
C ABI Entry point called by crystal_bridge when game library is loaded
-
load(path : String, type_hint : String = "", cache_mode : Int64 = 0_i64) : Godot::Resource
Global convenience helper to load resources from Godot VFS
-
preload(path : String) : Godot::Resource
Global convenience helper to preload resources from Godot VFS
-
vec2(x : Number, y : Number) : Godot::Vector2
Top-level math constructors
- vec3(x : Number, y : Number, z : Number) : Godot::Vector3
- vec4(x : Number, y : Number, z : Number, w : Number) : Godot::Vector4
Macro Summary
-
abstract_class
Convenience macro to designate a class as abstract in Godot.
-
await(target, signal_name = nil, timeout_sec = nil)
Top-level await macro for intuitive GDScript-like calling syntax Usage: await(enemy.died) await(enemy.died, timeout_sec: 2.0) await(enemy, "died") await(enemy, "died", timeout_sec: 2.0) await(timer.timeout) await(timer) await(1.5) await(2.seconds)
-
await_until(condition, timeout_sec, &block)
Cooperatively yields the current fiber until the condition evaluates to truthy.
-
await_while(condition, timeout_sec, &block)
Cooperatively yields the current fiber while the condition evaluates to truthy.
-
cold_boot_test(category, name, &block)
Dedicated declarative cold boot test macro
- define_log_filter(name, **opts)
- define_log_filters(&block)
-
delegate_property_to_instance(*prop_names)
Forwards class-level properties to the class singleton instance
-
delegate_to_instance(*method_names)
Forwards class-level methods to the class singleton instance (e.g.
-
emit(signal_expr, *args)
Type-safe signal emitter macro.
-
ensure_lapis
The primary
nodemacro: Usage: node MyNode node MyNode do # defaults to Godot::Node end -
export_category(name, &block)
Categories group top-level inspector sections in Godot.
-
export_group(name, prefix = "", &block)
Groups exported properties in the Godot inspector.
-
export_subgroup(name, prefix = "", &block)
Subgroups exported properties under the current inspector group.
-
gdclass(decl, &block)
Declares a custom RefCounted or generic Godot engine class registered with ClassDB.
-
gmodule(decl, &block)
Declares a reusable Godot module or mixin registered with ClassDB metadata.
-
godot_bind(var_name, class_name, method_name, hash)
Lazily retrieves and caches a GDExtension method bind handle from ClassDB
-
godot_call_str(method_name, *args)
Dynamically calls an instance method and returns the result as a Crystal String
-
godot_collider_query(cls_name, indexed = false)
Synthesizes null-safe #get_collider? query on raycasts and shapecasts
-
godot_marshal_enum(name, idx)
Marshals an enum or integer argument into a typed 64-bit pointer for ptrcall
-
godot_marshal_nodepath(name, idx)
Marshals a NodePath or String argument into an unmanaged Godot NodePath pointer
-
godot_marshal_obj(name, idx)
Marshals a Godot Object wrapper into an unmanaged pointer-to-pointer for ptrcall
-
godot_marshal_str(name, idx)
Marshals a String argument into an unmanaged Godot String pointer
-
godot_marshal_string_name(name, idx)
Marshals a String or StringName argument into an interned StringName pointer
-
godot_marshal_val(name, idx)
Marshals a primitive scalar (Float, Int, Bool, Vector2/3, Color) for ptrcall
- godot_module(decl)
-
godot_prop(prop_name, getter_name, setter_name = nil)
Synthesizes an ergonomic getter and setter pair
-
godot_ptrcall(mb, target_ptr, args_slice, ret_ptr)
Executes a low-overhead GDExtension ptrcall
-
godot_ptrcall_bool(mb, target_ptr, args_slice)
Executes a ptrcall returning a boolean
-
godot_ptrcall_enum(mb, target_ptr, args_slice, enum_type)
Executes a ptrcall returning a strongly-typed enum
-
godot_ptrcall_float(mb, target_ptr, args_slice)
Executes a ptrcall returning a float (Float64 / Float32)
- godot_ptrcall_float32(mb, target_ptr, args_slice)
- godot_ptrcall_float64(mb, target_ptr, args_slice)
-
godot_ptrcall_int(mb, target_ptr, args_slice)
Executes a ptrcall returning an integer (Int64)
-
godot_ptrcall_obj(mb, target_ptr, args_slice, class_type)
Executes a ptrcall returning a typed object wrapper
-
godot_ptrcall_val(mb, target_ptr, args_slice, type_name)
Executes a ptrcall returning a value type with default constructor (e.g.
-
godot_ptrcall_void(mb, target_ptr, args_slice)
Executes a void ptrcall with no return buffer
-
godot_return_enum(enum_type, ret_var)
Instantiates a strongly-typed enum from a 64-bit ptrcall return buffer
-
godot_return_obj(class_type, ret_ptr)
Wraps a returned native object pointer into its typed Crystal wrapper
-
godot_signal(name, *types)
Synthesizes a first-class typed signal accessor and direct emission helper
-
godot_singleton(cls_name, godot_name, parent_type = Godot::Object)
Defines a Godot singleton accessor and pointer caching
-
godot_singleton_accessor(method_name, cls_name)
Emits top-level Godot module singleton helper
-
godot_static_call_str(method_name, *args)
Dynamically calls a static engine method and returns the result as a Crystal String
-
group(*group_names)
Declaratively assigns the node to one or more scene tree groups upon
_ready. -
icon(path)
Convenience macro to set a custom icon path in the editor.
-
log_filter(name, **opts)
Re-export at top-level for maximum ergonomics
-
multiplayer_test(name, clients = 2, &block)
Dedicated declarative multiplayer simulation test macro
-
n!(path, type = nil)
Ultra-short aliases for node! and node?
- n?(path, type = nil)
- node(decl, &block)
-
node!(path, type = nil)
Compact node retrieval macro (GDScript $ analog).
-
node2d(decl, &block)
Expressive convenience macro for 2D scene nodes defaulting to Godot::Node2D
-
node3d(decl, &block)
Expressive convenience macro for 3D spatial nodes defaulting to Godot::Node3D
-
node?(path, type = nil)
Safe compact node retrieval macro (returns nil if not found).
-
node_path!(path)
Creates a compile-time verified Godot::NodePath
-
node_ref(decl)
Declares a
node_refproperty initialized from the scene tree during_ready. -
node_ref(name_or_decl, type = nil, path = nil)
Declares a dead-pointer safe, lazy-cached node property matching Godot's
@onreadypattern. -
onready(decl)
Declares an
@onreadynode property initialized from the scene tree during_ready. -
onready(name, type, path = nil)
Declares a lazy-cached node property matching Godot's
@onreadypattern. -
onready?(name, type, path = nil)
Declares a safe, lazy-cached node property that returns nil if missing or type mismatch.
-
resource(decl, &block)
Declares a custom Godot Resource class registered with ClassDB and EditorHelp.
-
signal(name_or_decl, *extra_types)
Declares a custom Godot signal and generates a type-safe
emit_<signal_name>helper method. -
static_unload
Convenience macro to mark extension library unloading behavior.
-
test_case(category, name, cold_boot = false, &block)
Base test_case macro
-
test_suite(category, &block)
Declarative suite macro allowing grouped tests, parameterized tests, and suite/case lifecycle hooks
-
u!(name, type = nil)
Ultra-short aliases for unique! and unique?
- u?(name, type = nil)
-
unique!(name, type = nil)
Compact Scene Unique Node retrieval macro (GDScript % analog).
-
unique?(name, type = nil)
Safe compact Scene Unique Node retrieval macro (returns nil if not found).
-
unique_node(name, type, unique_name = nil)
Declares a lazy-cached Scene Unique Node property (Godot 4
%Nodesyntax). -
unique_node?(name, type, unique_name = nil)
Declares a safe, lazy-cached Scene Unique Node property that returns nil if missing.
-
unique_node_ref(decl)
Declares a
unique_node_refproperty initialized from the scene tree during_ready. -
unique_node_ref(name_or_decl, type = nil, unique_name = nil)
Declares a dead-pointer safe, lazy-cached Scene Unique Node property (Godot 4
%Nodesyntax). -
warning_ignore(name)
Convenience macro to suppress compiler warnings.
- warning_ignore_restore(name)
- warning_ignore_start(name)
Instance methods inherited from module Lapis::Test
add_child_autofree(parent : Godot::Node, child : T) : T forall Tadd_child_autofree(child : T) : T forall T add_child_autofree, assert_alive(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_alive, assert_approx_eq(actual : Float32 | Float64, expected : Float32 | Float64, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_approx_eq, assert_between(actual : Number, min : Number, max : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_between, assert_connected(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_connected, assert_disposed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_disposed, assert_emits(emitter : Godot::Object, signal_name : String, timeout_sec : Float64 = 2.0, file : String = __FILE__, line : Int32 = __LINE__, &) : Array(Variant) assert_emits, assert_empty(collection, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_empty, assert_eq(actual, expected, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_eq, assert_false(cond : Bool, msg : String = "Expected false, got true", file : String = __FILE__, line : Int32 = __LINE__) assert_false, assert_file_does_not_exist(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_file_does_not_exist, assert_file_empty(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_file_empty, assert_file_exists(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_file_exists, assert_file_not_empty(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_file_not_empty, assert_freed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_freed, assert_gt(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_gt, assert_gte(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_gte, assert_has_method(obj : Godot::Object, method_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_has_method, assert_has_node(parent : Godot::Node, path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_has_node, assert_has_signal(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_has_signal, assert_in_delta(actual : Number, expected : Number, delta : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_in_delta, assert_includes(collection, item, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_includes, assert_invalid_id(instance_id : UInt64 | Int64, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_invalid_id, assert_is_a(obj, klass : T.class, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) forall T assert_is_a, assert_lt(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_lt, assert_lte(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_lte, assert_ne(actual, expected, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_ne, assert_nil(val, msg : String = "Expected nil value", file : String = __FILE__, line : Int32 = __LINE__) assert_nil, assert_no_emit(emitter : Godot::Object, signal_name : String, duration_sec : Float64 = 0.5, file : String = __FILE__, line : Int32 = __LINE__, &) : Void assert_no_emit, assert_no_leak(max_delta_objects : Int32 = 0, name : String = "Operation", file : String = __FILE__, line : Int32 = __LINE__, &) assert_no_leak, assert_no_new_orphans(msg : String = "", file : String = __FILE__, line : Int32 = __LINE__, &) assert_no_new_orphans, assert_not_between(actual : Number, min : Number, max : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_not_between, assert_not_connected(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_not_connected, assert_not_empty(collection, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_not_empty, assert_not_freed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_not_freed, assert_not_nil(val, msg : String = "Expected non-nil value", file : String = __FILE__, line : Int32 = __LINE__) assert_not_nil, assert_not_same(actual : Reference, expected : Reference, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_not_same, assert_raises(klass : T.class, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__, &) forall T assert_raises, assert_refcount(refcounted : Godot::RefCounted, expected : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_refcount, assert_same(actual : Reference, expected : Reference, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_same, assert_signal_count(spy : SignalSpy, count : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_signal_count, assert_signal_emit_count(spy : SignalSpy, count : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_signal_emit_count, assert_signal_emitted(spy : SignalSpy, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_signal_emitted, assert_signal_not_emitted(spy : SignalSpy, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_signal_not_emitted, assert_string_contains(str : String, substr : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_string_contains, assert_string_ends_with(str : String, suffix : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_string_ends_with, assert_string_starts_with(str : String, prefix : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_string_starts_with, assert_true(cond : Bool, msg : String = "Expected true, got false", file : String = __FILE__, line : Int32 = __LINE__) assert_true, assert_valid_id(instance_id : UInt64 | Int64, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_valid_id, assert_vector_approx(actual : Godot::Vector2, expected : Godot::Vector2, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
assert_vector_approx(actual : Godot::Vector3, expected : Godot::Vector3, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
assert_vector_approx(actual : Godot::Color, expected : Godot::Color, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) assert_vector_approx, autofree(obj : T) : T forall T autofree, autofree_all : Void autofree_all, autoqfree(node : T) : T forall T autoqfree, await_signal(emitter : Godot::Object, signal_name : String, timeout_sec : Float64 = 2.0, file : String = __FILE__, line : Int32 = __LINE__) : Array(Variant) await_signal, cleanup_autofree : Void cleanup_autofree, cleanup_tracked_nodes : Void cleanup_tracked_nodes, input_sender : InputSender input_sender, pending(reason : String = "Test pending implementation") : Nil pending, simulate(node : Godot::Node, frames : Int32 = 1, delta : Float64 = 0.016666666666666666, physics : Bool = false) : Void simulate, skip_frames(count : Int32 = 1) : Void skip_frames, skip_if(condition : Bool, reason : String = "Test skipped") : Nil skip_if, skip_physics_frames(count : Int32 = 1) : Void skip_physics_frames, suppress_errors(&) suppress_errors, track_node(node : Godot::Node) : Godot::Node track_node, with_node(klass : T.class, parent : Godot::Node | Nil = nil, &block : T -> Void) forall T with_node, with_timeout(timeout_sec : Float64 = 5.0, operation_name : String = "Operation", file : String = __FILE__, line : Int32 = __LINE__, &) with_timeout
Class methods inherited from module Lapis::Test
autofree_objects
autofree_objects,
autoqfree_nodes
autoqfree_nodes,
tracked_nodes
tracked_nodes
Method Detail
C ABI Entry point called by crystal_bridge when game library is loaded
Global convenience helper to load resources from Godot VFS
Global convenience helper to preload resources from Godot VFS
Macro Detail
Top-level await macro for intuitive GDScript-like calling syntax Usage: await(enemy.died) await(enemy.died, timeout_sec: 2.0) await(enemy, "died") await(enemy, "died", timeout_sec: 2.0) await(timer.timeout) await(timer) await(1.5) await(2.seconds)
Cooperatively yields the current fiber until the condition evaluates to truthy. Usage: await_until(character.on_floor?) await_until(resource.loaded?, timeout_sec: 10.0)
Cooperatively yields the current fiber while the condition evaluates to truthy. Usage: await_while(tween.is_running) await_while(character.moving?, timeout_sec: 5.0)
Forwards class-level properties to the class singleton instance
Forwards class-level methods to the class singleton instance (e.g. Input, AudioServer)
Type-safe signal emitter macro.
Emits signals with compile-time type verification, matching the parameter types and argument counts declared by the signal.
Examples:
emit(player.health_changed, 50, 100) # Expands to player.emit_health_changed(50, 100)
emit(player.renamed) # Expands to player.emit_renamed
emit(health_changed, 50, 100) # Inside Player: expands to emit_health_changed(50, 100)
emit(sig, 50, 100) # Signal variable: expands to sig.emit(50, 100)
The primary node macro:
Usage:
node MyNode
node MyNode do
# defaults to Godot::Node
end
node Player < CharacterBody3D node Player < CharacterBody3D do # inherits Godot::CharacterBody3D end Expressive loader macro to ensure Lapis engine bindings are loaded without duplicate require cycles or missing dependency errors
Categories group top-level inspector sections in Godot.
May be used standalone or as a block scoping exported properties:
export_category "Combat" do
@[Export]
property health : Int32 = 100
end
Groups exported properties in the Godot inspector.
May be used standalone or as a block scoping exported properties:
export_group "Movement", prefix: "move_" do
@[Export]
property move_speed : Float32 = 5.0_f32
end
Subgroups exported properties under the current inspector group.
May be used standalone or as a block scoping exported properties:
export_subgroup "Advanced", prefix: "adv_" do
@[Export]
property adv_friction : Float32 = 0.1_f32
end
Declares a custom RefCounted or generic Godot engine class registered with ClassDB.
Defaults to inheriting RefCounted when no parent is specified.
Can be called with or without a block (e.g. gdclass MyState).
gdclass StateMachine < RefCounted do
@[Export]
property current_state : String = "idle"
end
gdclass SimpleState
Declares a reusable Godot module or mixin registered with ClassDB metadata.
Can declare properties (with @[Export]), signals, lifecycle hooks, and interface methods.
When included into a node, gdclass, or resource via include, its properties
and signals are automatically registered with ClassDB and dispatched via the GDExtension bridge.
Examples:
gmodule Damageable do
signal health_changed(current : Int32, max : Int32)
signal died
@[Export(range: 0..100)]
property health : Int32 = 100
@[Export]
property max_health : Int32 = 100
def take_damage(amount : Int32) : Void
self.health = Math.max(0, self.health - amount)
emit(health_changed, self.health, self.max_health)
emit(died) if self.health == 0
end
end
node Player < CharacterBody2D do
include Damageable
end
Lazily retrieves and caches a GDExtension method bind handle from ClassDB
Dynamically calls an instance method and returns the result as a Crystal String
Synthesizes null-safe #get_collider? query on raycasts and shapecasts
Marshals an enum or integer argument into a typed 64-bit pointer for ptrcall
Marshals a NodePath or String argument into an unmanaged Godot NodePath pointer
Marshals a Godot Object wrapper into an unmanaged pointer-to-pointer for ptrcall
Marshals a String argument into an unmanaged Godot String pointer
Marshals a String or StringName argument into an interned StringName pointer
Marshals a primitive scalar (Float, Int, Bool, Vector2/3, Color) for ptrcall
Synthesizes an ergonomic getter and setter pair
Executes a low-overhead GDExtension ptrcall
Executes a ptrcall returning a strongly-typed enum
Executes a ptrcall returning a float (Float64 / Float32)
Executes a ptrcall returning an integer (Int64)
Executes a ptrcall returning a typed object wrapper
Executes a ptrcall returning a value type with default constructor (e.g. Vector2, Vector3, Color, Transform3D)
Executes a void ptrcall with no return buffer
Instantiates a strongly-typed enum from a 64-bit ptrcall return buffer
Wraps a returned native object pointer into its typed Crystal wrapper
Synthesizes a first-class typed signal accessor and direct emission helper
Defines a Godot singleton accessor and pointer caching
Emits top-level Godot module singleton helper
Dynamically calls a static engine method and returns the result as a Crystal String
Declaratively assigns the node to one or more scene tree groups upon _ready.
node Player < CharacterBody3D do
group "players", "flammable"
end
Dedicated declarative multiplayer simulation test macro
Compact node retrieval macro (GDScript $ analog). Supports:
- Type-inferred:
node!(Sprite2D)->get_node_as("Sprite2D", Sprite2D) - Path + Type:
node!("Visuals/Sprite2D", Sprite2D)->get_node_as("Visuals/Sprite2D", Sprite2D) - Path string:
node!("Visuals/Sprite2D")->get_node("Visuals/Sprite2D")
Expressive convenience macro for 2D scene nodes defaulting to Godot::Node2D
Expressive convenience macro for 3D spatial nodes defaulting to Godot::Node3D
Declares a dead-pointer safe, lazy-cached node property matching Godot's @onready pattern.
Supports:
- Macro signature:
node_ref player, Player, "Player" - Type declaration:
node_ref player : Player = "Player" - Auto-inferred:
node_ref sprite_2d : Sprite2D
Declares an @onready node property initialized from the scene tree during _ready.
Declares a lazy-cached node property matching Godot's @onready pattern.
Supports:
- Auto-inferred path:
onready sprite_2d, Sprite2D(fetches "Sprite2D") - Scene Unique Node:
onready camera, Camera2D, "%MainCamera" - Explicit path:
onready sprite, Sprite2D, "Visuals/Sprite2D"
Declares a safe, lazy-cached node property that returns nil if missing or type mismatch.
Examples:
onready? player, PlayerController, "Player"
onready? hud, GameHUD, "HUD"
Declares a custom Godot Resource class registered with ClassDB and EditorHelp.
Supports @[Export] properties, custom signals, and serialization to .tres.
resource ItemData < Resource do
@[Export]
property item_name : String = "Health Potion"
Declares a custom Resource subclass registered with ClassDB.
Defaults to inheriting `Resource` when no parent is specified.
Can be called with or without a block (e.g. `resource MyItem`).
resource CustomPotion do @[Export] property item_name : String = "Health Potion"
@[Export] property value : Int32 = 50 end
resource ShortItem
Declares a custom Godot signal and generates a type-safe emit_<signal_name> helper method.
class Player < Godot::CharacterBody3D
signal health_changed(new_health : Int32, max_health : Int32)
signal died
def take_damage(amount : Int32)
emit_health_changed(50, 100)
emit_died if amount >= 100
end
end
Declarative suite macro allowing grouped tests, parameterized tests, and suite/case lifecycle hooks
Compact Scene Unique Node retrieval macro (GDScript % analog). Supports:
- Type-inferred:
unique!(ProgressBar)->get_node_as("%ProgressBar", ProgressBar) - Name + Type:
unique!("HealthBar", ProgressBar)->get_node_as("%HealthBar", ProgressBar) - Name string:
unique!("HealthBar")->get_node("%HealthBar")
Safe compact Scene Unique Node retrieval macro (returns nil if not found).
Declares a lazy-cached Scene Unique Node property (Godot 4 %Node syntax).
Examples:
unique_node health_bar, ProgressBar # fetches "%HealthBar"
unique_node main_hud, CanvasLayer, "HUD" # fetches "%HUD"
Declares a safe, lazy-cached Scene Unique Node property that returns nil if missing.
Examples:
unique_node? health_bar, ProgressBar, "HealthBar"
Declares a unique_node_ref property initialized from the scene tree during _ready.
Declares a dead-pointer safe, lazy-cached Scene Unique Node property (Godot 4 %Node syntax).
Supports:
- Macro signature:
unique_node_ref camera, Camera2D, "MainCamera" - Type declaration:
unique_node_ref camera : Camera2D = "MainCamera" - Auto-inferred:
unique_node_ref main_hud : CanvasLayer