class
Godot::Object
- Godot::Object
- Reference
- Object
Overview
Base class for all Godot engine objects and extension classes. Provides identity, lifecycle dispatch hooks, and signal emission functionality.
Direct Known Subclasses
- Godot::AccessibilityServer
- Godot::AudioServer
- Godot::CameraServer
- Godot::ClassDB
- Godot::DisplayServer
- Godot::EditorFileSystemDirectory
- Godot::EditorInterface
- Godot::EditorPaths
- Godot::EditorSelection
- Godot::EditorUndoRedoManager
- Godot::EditorVCSInterface
- Godot::Engine
- Godot::EngineDebugger
- Godot::FramebufferCacheRD
- Godot::GDExtensionManager
- Godot::Geometry2D
- Godot::Geometry3D
- Godot::GodotInstance
- Godot::Input
- Godot::InputMap
- Godot::IP
- Godot::JavaClassWrapper
- Godot::JavaScriptBridge
- Godot::JNISingleton
- Godot::JSONRPC
- Godot::MainLoop
- Godot::Marshalls
- Godot::MovieWriter
- Godot::NativeMenu
- Godot::NavigationMeshGenerator
- Godot::NavigationServer2D
- Godot::NavigationServer2DManager
- Godot::NavigationServer3D
- Godot::NavigationServer3DManager
- Godot::Node
- Godot::OpenXRExtensionWrapper
- Godot::OpenXRInteractionProfileMetadata
- Godot::OS
- Godot::Performance
- Godot::PhysicsDirectBodyState2D
- Godot::PhysicsDirectBodyState3D
- Godot::PhysicsDirectSpaceState2D
- Godot::PhysicsDirectSpaceState3D
- Godot::PhysicsServer2D
- Godot::PhysicsServer2DManager
- Godot::PhysicsServer3D
- Godot::PhysicsServer3DManager
- Godot::PhysicsServer3DRenderingServerHandler
- Godot::ProjectSettings
- Godot::RefCounted
- Godot::RenderData
- Godot::RenderingDevice
- Godot::RenderingServer
- Godot::RenderSceneData
- Godot::ResourceLoader
- Godot::ResourceSaver
- Godot::ResourceUID
- Godot::ScriptLanguage
- Godot::ShaderIncludeDB
- Godot::TextServerManager
- Godot::TextureStreaming
- Godot::ThemeDB
- Godot::TileData
- Godot::Time
- Godot::TranslationServer
- Godot::TreeItem
- Godot::UndoRedo
- Godot::UniformSetCacheRD
- Godot::WorkerThreadPool
- Godot::XRServer
- Godot::XRVRS
Defined in:
lapis/dsl/frame_arena_dsl.crlapis/gd_extras/node_queries.cr
libgodot/classes/object.cr
libgodot/extensions.cr
libgodot/extensions/primitives.cr
libgodot/generated/classes/classes_part1.cr
libgodot/variant.cr
Constant Summary
-
NOTIFICATION_EXTENSION_RELOADED =
2_i64 -
NOTIFICATION_POSTINITIALIZE =
0_i64 -
NOTIFICATION_PREDELETE =
1_i64
Constructors
-
._wrap_ptrcall_return(ptr : Pointer(Void)) : self
Wraps a raw pointer returned by
godot_ptrcall, reusing any live extension instance. -
.~ : self
Class unary ~ returns typed instance looked up from active NodeContext (by name first, then searching children)
-
.create : self
Class-level constructor returning a new native Godot instance
-
.create(&block : self -> ) : self
Class-level constructor configuring a new native Godot instance in a block
- .new(pointer : Pointer(Void) = Pointer(Void).null)
-
.new(&block : self -> ) : self
Instantiates a new native Godot object and configures it in a block
Class Method Summary
-
._godot_has_virtual_method(method_name : String) : Bool
Checks if this object class overrides a generic virtual method.
- ._wrap_ptrcall_return_or_nil(ptr : Pointer(Void)) : self | Nil
-
.cast_to(obj : Object, type : T.class) : T forall T
Class-level casting helper raising TypeCastError
-
.cast_to?(obj : Object, type : T.class) : T | Nil forall T
Class-level casting helper
- .clear_script_info_cache! : Void
- .find_script_info_for_node(node : Godot::Object) : NamedTuple(path: String, line: Int32, class_name: String, parent_name: String, is_tool: Bool) | Nil
-
.find_script_location_for_class(target_cls : String) : Tuple(String, Int32)
Discovers the .cr source file and 1-based line number corresponding to a custom node/resource class
-
.find_script_path_for_class(target_cls : String) : String
Discovers a .cr source file corresponding to a custom node/class
-
.is_instance_id_valid(id : Int | UInt64) : Bool
Checks if a 64-bit instance ID is currently valid in Godot's ObjectDB
-
.is_internal_or_brush_class?(cls_name : String) : Bool
Returns true if the given class name is a built-in engine class, internal Lapis class, or UniBuilder brush class
- .resolve_cached_class_script_info(cls_name : String, default_parent : String = "Node", default_tool : Bool = false) : NamedTuple(path: String, line: Int32, class_name: String, parent_name: String, is_tool: Bool) | Nil
Instance Method Summary
-
#==(other : Godot::Object) : Bool
Value equality based on Godot engine identity (instance ID, underlying pointer, or reference identity)
- #==(other : Nil) : Bool
-
#_enter_tree : Void
Lifecycle callback called when the node enters the tree hierarchy.
-
#_exit_tree : Void
Lifecycle callback called when the node exits the tree hierarchy.
-
#_godot_bind_static_signals(force : Bool = false) : Void
Binds declarative class-level
on_signaland@[OnSignal]callbacks toStaticSignalTableslots. -
#_godot_bind_static_signals_impl(tid : UInt64) : Void
Internal hook overridden by
nodeandgmodulemacros to bind compile-time typed procs toStaticSignalTable. -
#_godot_call_tool_button(button_name : String) : Void
Dispatches inspector tool button clicks on this object.
-
#_godot_call_virtual(method_name : String, delta : Float64) : Void
Virtual method and property dispatch hooks overridden by class registration macros.
-
#_godot_call_virtual_with_data(method_name : String, args : Pointer(Pointer(Void)), ret : Pointer(Void)) : Void
Dispatches generic virtual methods with raw arguments and return buffer.
- #_godot_dispatch_crystal_0(method : String) : Bool
- #_godot_dispatch_crystal_1(method : String, a0 : Variant) : Bool
- #_godot_dispatch_crystal_2(method : String, a0 : Variant, a1 : Variant) : Bool
-
#_godot_get_property(prop_name : String, ret_ptr : Pointer(Void)) : Void
Invoked by the GDExtension bridge when retrieving an exposed
@exportproperty. - #_godot_has_crystal_method?(method : String) : Bool
-
#_godot_set_property(prop_name : String, val_ptr : Pointer(Void)) : Void
Invoked by the GDExtension bridge when setting an exposed
@exportproperty. -
#_mark_destroyed_by_engine! : Void
Internal helper invoked by Bridge
free_fnwhen Godot C++ deallocates a Crystal object. -
#_physics_process(delta : Float64) : Void
Fixed-rate physics process callback receiving delta timestep in seconds (
Float64). -
#_process(delta : Float64) : Void
Per-frame process callback receiving delta timestep in seconds (
Float64). -
#_ready : Void
Lifecycle callback called when the node enters the active scene tree.
-
#~ : self
Instance unary ~ returns self, allowing ~self or nested unary chaining
-
#active? : Bool
Returns true if the object is active and not destroyed (works in both engine and standalone unit specs)
- #add_user_signal(signal : String, arguments : Pointer(Void)) : Void
-
#alive? : Bool
Returns true if this object instance has a valid engine pointer and is alive in Godot's ObjectDB
-
#apply_dictionary_properties!(dict : Godot::Dictionary) : Void
Populates
@[Export]properties on this object from aGodot::Dictionary. -
#as_a(type : T.class) : T forall T
Re-wraps or downcasts this Godot object pointer to the requested Godot wrapper class T, raising TypeCastError if incompatible.
-
#as_a?(type : T.class) : T | Nil forall T
Re-wraps or downcasts this Godot object pointer to the requested Godot wrapper class T, verifying that the underlying native object inherits from T.
- #as_g(type : T.class) : T forall T
-
#as_g?(type : T.class) : T | Nil forall T
Ergonomic aliases for polymorphic downcasting
-
#as_t(type : T.class) : T forall T
Shorthand alias matching Variant#as_t(T)
-
#as_t?(type : T.class) : T | Nil forall T
Shorthand alias for as_t?(T)
-
#await_signal(signal_name : String | Symbol, timeout_sec : Float64 | Nil = nil) : AwaitStatus(Array(Variant))
Cooperatively awaits a signal emitted on this object.
- #await_signal(signal_name : String | Symbol, timeout_sec : Number) : AwaitStatus(Array(Variant))
-
#await_signal!(signal_name : String | Symbol, timeout_sec : Float64 | Nil = nil) : Array(Variant)
Cooperatively awaits a signal emitted on this object, raising
TimeoutErrorif timeout expires. - #await_signal!(signal_name : String | Symbol, timeout_sec : Number) : Array(Variant)
-
#await_signal?(signal_name : String | Symbol, timeout_sec : Float64 | Nil = nil) : Array(Variant) | Nil
Cooperatively awaits a signal emitted on this object, returning nil if timeout expires.
- #await_signal?(signal_name : String | Symbol, timeout_sec : Number) : Array(Variant) | Nil
- #bind_property_list_changed(callback : Proc(R), once : Bool = false) : UInt64 forall R
- #bind_property_list_changed(once : Bool = false, &block : -> Void) : UInt64
- #bind_script_changed(callback : Proc(R), once : Bool = false) : UInt64 forall R
- #bind_script_changed(once : Bool = false, &block : -> Void) : UInt64
-
#bind_static_signal(signal_name : String, callback : Proc(*T, R), once : Bool = false) : UInt64 forall T, R
Binds a compile-time typed
Proc(*T, R)directly to this object'sStaticSignalTableslot. -
#bind_static_signal(signal_name : Symbol, callback : Proc(*T, R), once : Bool = false) : UInt64 forall T, R
Binds a compile-time typed
Proc(*T, R)directly to this object'sStaticSignalTableslot (Symbol overload). -
#blocking_signals? : Bool
Predicate alias for
#is_blocking_signals -
#build(&block : self -> Void) : self
Fluent inline configuration block yielding self and returning self
-
#call(method : String, args : Array(Variant)) : Pointer(Void)
Calls the named method on the object with an array of Variants.
-
#call(method : String, *args) : Pointer(Void)
Calls the named method on the object with variable arguments.
-
#call_bool(method : String, *args) : Bool
Calls the named method and returns the result as Bool
-
#call_deferred(method : String, *args) : Pointer(Void)
Calls the named method on the object during idle time.
-
#call_f64(method : String, *args) : Float64
Calls the named method and returns the result as Float64
-
#call_i64(method : String, *args) : Int64
Calls the named method and returns the result as Int64
-
#call_obj(method : String, *args) : Node | Nil
Calls the named method and returns an Object/Node (or nil if null)
-
#call_obj_as(type : T.class, method : String, *args) : T | Nil forall T
Calls the named method and returns the result cast to T (or nil if null)
-
#call_str(method : String, *args) : String
Calls the named method and returns the result as String
- #callv(method : String, arg_array : Pointer(Void)) : Pointer(Void)
- #can_translate_messages : Bool
-
#can_translate_messages? : Bool
Predicate alias for
#can_translate_messages - #cancel_free : Void
-
#cast_to(type : T.class) : T forall T
Shorthand alias for as_a(T)
-
#cast_to?(type : T.class) : T | Nil forall T
Shorthand alias for as_a?(T)
-
#check_alive! : Void
Validates that the underlying engine object is still alive before executing bridge calls.
-
#class?(godot_class : String) : Bool
Predicate alias for
#is_class -
#configure(&block : self -> Void) : self
Fluent configuration block alias
-
#connect(signal_name : String, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None, callback : Proc(Array(Variant), Void) | Nil = nil, receiver : Godot::Object | Nil = nil) : SignalSubscription
Connects a callback proc to the named signal.
-
#connect(signal_name : String, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None, receiver : Godot::Object | Nil = nil, &block : Array(Variant) -> Void) : SignalSubscription
Connects a callback block accepting Array(Variant) to the named signal.
-
#connect(signal_name : Symbol, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None, &block : Array(Variant) -> Void) : SignalSubscription
Connects a callback block to the named signal symbol.
-
#connect(signal_name : String, listener_target : Godot::Object, method_name : Symbol, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None) : SignalSubscription
Connects the named signal to a method call on a listener target by symbol name.
- #connect(signal : String, callable : Pointer(Void), flags : Int64 = 0_i64) : Godot::Error
-
#connect_one_shot(signal_name : String, &block : Array(Variant) -> Void) : SignalSubscription
Connects a one-shot callback block to the named signal (backwards compatibility).
-
#connected?(signal : String, callable : Pointer(Void)) : Bool
Predicate alias for
#is_connected -
#destroy : Void
Destroys this Object in the Godot engine and invalidates the Crystal pointer.
- #destroyed? : Bool
- #disconnect(signal : String, callable : Pointer(Void)) : Void
-
#disconnect(signal_name : String) : Void
Disconnects all signal subscriptions for the named signal on this object.
-
#disconnect(signal_name : Symbol) : Void
Disconnects all subscriptions for the specified signal (Symbol overload)
-
#disconnect_all(signal_name : String | Symbol) : self
Disconnects all subscriptions for the specified signal, returning self
-
#disconnect_all : self
Disconnects all subscriptions across ALL signals on this object, returning self
-
#editor_hint? : Bool
Returns true if running inside the Godot Editor
-
#emit(signal_name : String | Symbol, *args) : self
Emits the named signal with arguments, returning self
-
#emit(signal : BoundSignal, *args) : self
Emits a bound or typed signal with arguments, returning self
- #emit_property_list_changed : Void
- #emit_script_changed : Void
-
#emit_signal(name : String) : Void
Emits a parameterless signal on this Godot object with zero GC heap allocations.
-
#emit_signal(name : String, *args) : Void
Emits a signal with variable arguments on this Godot object.
-
#emit_static_signal(signal_name : String, *args : *T) : Int32 forall T
Emits a typed signal directly through
StaticSignalTable.globalwith zero GC heap allocations. -
#emit_static_signal(signal_name : Symbol, *args : *T) : Int32 forall T
Emits a typed signal directly through
StaticSignalTable.global(Symbol overload). - #explicitly_freed? : Bool
-
#export_config_hash : UInt64
Computes a deterministic 64-bit hash of all
@[Export]properties on this object. -
#frame_arena : Lapis::Core::FrameArena
Returns the active
Lapis::Core::FrameArenascratchpad for the current frame. -
#frame_buffer(type : T.class, max_elements : Int32) : Lapis::Core::ArenaBuffer(T) forall T
Allocates a per-frame appendable
ArenaBuffer(T)ofmax_elementsfromFrameArena.current. -
#frame_scope(&block : Lapis::Core::FrameArena -> _)
Executes a temporary scratch allocation scope on the current
FrameArenathat automatically rewinds when the block finishes. -
#frame_slice(type : T.class, count : Int32) : Slice(T) forall T
Allocates a per-frame scratch
Slice(T)ofcountelements fromFrameArena.current. -
#free : Void
Destroys this Object in the Godot engine (alias to #destroy).
- #get(property : String) : Pointer(Void)
- #get_class : String
- #get_incoming_connections : Pointer(Void)
- #get_indexed(property_path : NodePath | String) : Pointer(Void)
- #get_instance_id : Int64
- #get_meta(name : String, default : Pointer(Void) | Nil = nil) : Pointer(Void)
- #get_meta(key : Symbol, default : Pointer(Void) | Nil = nil) : Pointer(Void)
- #get_meta(name : String, default : Pointer(Void) | Nil = nil) : Pointer(Void)
-
#get_meta(name : String, default : Pointer(Void) | Nil = nil) : Pointer(Void)
Overrides auto-generated raw
Pointer(Void)metadata getter to avoid passing an 8-byte stackVoid*as a 24-byteVariantdefault argument ingodot_ptrcall. - #get_meta(key : Symbol, default : Pointer(Void) | Nil = nil) : Pointer(Void)
- #get_meta(name : String, default : Pointer(Void) | Nil = nil) : Pointer(Void)
-
#get_meta_bool(key : String | Symbol, default : Bool = false) : Bool
Retrieves boolean metadata stored on this object, or
defaultif not set. - #get_meta_color(key : String | Symbol, default : Color = Color::WHITE) : Color
-
#get_meta_f32(key : String | Symbol, default : Float32 = 0.0_f32) : Float32
Retrieves floating-point metadata stored on this object as a
Float32, ordefaultif not set. -
#get_meta_f64(key : String | Symbol, default : Float64 = 0.0) : Float64
Retrieves floating-point metadata stored on this object as a
Float64, ordefaultif not set. -
#get_meta_i32(key : String | Symbol, default : Int32 = 0) : Int32
Retrieves integer metadata stored on this object as an
Int32, ordefaultif not set. -
#get_meta_i64(key : String | Symbol, default : Int64 = 0_i64) : Int64
Retrieves integer metadata stored on this object as an
Int64, ordefaultif not set. - #get_meta_list : Pointer(Void)
-
#get_meta_object(key : String | Symbol, type : T.class = Godot::Object) : T | Nil forall T
Safely retrieves a
Godot::Objectfrom metadata by validating its 64-bit ObjectDB#instance_id(or direct object Variant) and resolving any live Crystal subclass instance. -
#get_meta_str(key : String | Symbol, default : String = "") : String
Retrieves string metadata stored on this object, or
defaultif not set. - #get_meta_transform3d(key : String | Symbol, default : Transform3D = Transform3D.identity) : Transform3D
- #get_meta_vector2(key : String | Symbol, default : Vector2 = Vector2.zero) : Vector2
- #get_meta_vector3(key : String | Symbol, default : Vector3 = Vector3.zero) : Vector3
- #get_method_argument_count(method : String) : Int64
- #get_method_list : Pointer(Void)
- #get_property_list : Pointer(Void)
- #get_script : Pointer(Void)
- #get_signal_connection_list(signal : String) : Pointer(Void)
- #get_signal_list : Pointer(Void)
- #get_translation_domain : String
-
#godot_as(type : T.class) : T forall T
Alias for as_a(T) used in gameplay codebases
-
#godot_as?(type : T.class) : T | Nil forall T
Alias for as_a?(T) used in gameplay codebases
- #has_connections(signal : String) : Bool
-
#has_connections?(signal : String) : Bool
Predicate alias for
#has_connections - #has_meta(name : String) : Bool
-
#has_meta(key : String | Symbol) : Bool
Returns
trueif this object has metadata stored underkey. -
#has_meta?(name : String) : Bool
Predicate alias for
#has_meta -
#has_method(method : String) : Bool
Checks both Crystal-defined methods on the live instance and native Godot methods.
-
#has_method?(method : String) : Bool
Predicate alias for
#has_method - #has_signal(signal : String) : Bool
-
#has_signal?(signal_name : String) : Bool
Returns true if this object or its registered class defines the given signal.
- #has_user_signal(signal : String) : Bool
-
#has_user_signal?(signal : String) : Bool
Predicate alias for
#has_user_signal -
#hash(hasher)
Hashing based on engine instance ID for use in Sets and Hash keys
-
#if_alive : self | Nil
Convenient nil-coalescing helper: returns self if alive, otherwise nil
-
#inspect(io : IO) : Void
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
- #instance_id : UInt64
- #is_blocking_signals : Bool
-
#is_blocking_signals? : Bool
Predicate alias for
#is_blocking_signals - #is_class(godot_class : String) : Bool
-
#is_class?(godot_class : String) : Bool
Predicate alias for
#is_class - #is_connected(signal : String, callable : Pointer(Void)) : Bool
-
#is_connected?(signal : String, callable : Pointer(Void)) : Bool
Predicate alias for
#is_connected - #is_queued_for_deletion : Bool
-
#is_queued_for_deletion? : Bool
Predicate alias for
#is_queued_for_deletion - #is_valid? : Bool
-
#link_class_script : Void
Automatically links this node's registered CrystalScript resource if running inside the Godot Editor
-
#live_instance : Godot::Object
Resolves the live Crystal subclass instance registered for this native pointer, or returns self.
-
#not_null? : Bool
Returns true if the underlying engine pointer is non-null and currently valid
- #notification(what : Int64, reversed : Bool = false) : Void
- #notify_property_list_changed : Void
-
#null? : Bool
Returns true if the underlying engine pointer is null or invalid
- #pointer : Pointer(Void)
- #pointer=(val : Pointer(Void))
-
#print(*args)
Prints a message to Godot's debug console.
-
#printerr(*args)
Prints an error message to Godot's error console.
- #property_can_revert(property : String) : Bool
-
#property_can_revert?(property : String) : Bool
Predicate alias for
#property_can_revert - #property_get_revert(property : String) : Pointer(Void)
- #property_list_changed : Godot::TypedSignal()
-
#property_list_changed=(val : Godot::BoundSignal) : Godot::BoundSignal
Identity setter enabling compound operator sugar (
node.property_list_changed += ->handler,node.property_list_changed -= ->handler) - #property_list_changed_signal_hash : UInt64
- #property_list_changed_slot : Lapis::Core::StaticSignalSlot()
-
#puts(*args)
Prints a message to Godot's debug console.
-
#queued_for_deletion? : Bool
Predicate alias for
#is_queued_for_deletion -
#queued_for_deletion_fast? : Bool
Fast check if this object is queued for deletion (
queue_free) or already destroyed. -
#rebind_static_signals! : Void
Explicitly rebinds all declarative
on_signaland@[OnSignal]callbacks toStaticSignalTableslots. - #remove_meta(name : String) : Void
-
#remove_meta(key : String | Symbol) : Void
Removes the metadata entry under
keyfrom this object. - #remove_user_signal(signal : String) : Void
- #script_changed : Godot::TypedSignal()
-
#script_changed=(val : Godot::BoundSignal) : Godot::BoundSignal
Identity setter enabling compound operator sugar (
node.script_changed += ->handler,node.script_changed -= ->handler) - #script_changed_signal_hash : UInt64
- #script_changed_slot : Lapis::Core::StaticSignalSlot()
- #set(property : String, value : Pointer(Void)) : Void
-
#set(property : String | Symbol, value : T) : Void forall T
Dynamically sets a property value on this object.
- #set_block_signals(enable : Bool) : Void
- #set_deferred(property : String, value : Pointer(Void)) : Void
- #set_indexed(property_path : NodePath | String, value : Pointer(Void)) : Void
- #set_message_translation(enable : Bool) : Void
-
#set_meta(key : String | Symbol, value : String | Int32 | Int64 | Float32 | Float64 | Bool | Symbol | Vector2 | Vector2i | Vector3 | Vector3i | Color | Transform3D | Basis | AABB | Quaternion | Plane | Rect2) : Void
Sets arbitrary metadata on this object with automatic Variant conversion.
- #set_meta(key : String | Symbol, value : Godot::Object) : Void
-
#set_meta(name : String, value : Pointer(Void)) : Void
Overrides auto-generated raw
Pointer(Void)metadata setter sovalueis stored safely as a 64-bit integer address viaVariant::INTrather than passing an 8-byte stackVoid*togodot_ptrcall_voidexpecting a 24-byteVariant. - #set_meta(key : Symbol, value : Pointer(Void)) : Void
- #set_meta(key : String | Symbol, value : Variant) : Void
-
#set_meta_object(key : String | Symbol, obj : Godot::Object | Nil) : Void
Safely stores a reference to a
Godot::Objectin metadata using its monotonic 64-bit ObjectDB#instance_id. - #set_script(script : Pointer(Void)) : Void
- #set_translation_domain(domain : String) : Void
-
#signal(name : String) : Godot::BoundSignal
Returns a bound signal representation for the named signal.
-
#signal(sym : Symbol) : Godot::BoundSignal
Returns a bound signal representation for the named signal symbol.
-
#signal_connection_count(signal_name : String) : Int32
Returns the count of active subscriptions for the given signal on this object.
-
#signal_target_id : UInt64
Identifier used for signal routing and lifecycle tracking (engine instance ID or Crystal object_id)
-
#static_signal_slot(signal_name : String, *types : *T) forall T
Returns a compile-time typed
StaticSignalSlot(*T)bound to this object inStaticSignalTable.global. -
#static_signal_slot(signal_name : Symbol, *types : *T) forall T
Returns a compile-time typed
StaticSignalSlot(*T)bound to this object by symbol name. -
#to_s(io : IO) : Void
Appends a short String representation of this object which includes its class name and its object address.
- #to_string : String
-
#to_unsafe : Pointer(Void)
Idiomatic Crystal pointer conversion
- #tr(message : String, context : String = "") : String
- #tr_n(message : String, plural_message : String, n : Int64, context : String = "") : String
-
#try? : self | Nil
Safe nil-coalescing check: returns self if alive in Godot's ObjectDB, otherwise nil.
-
#try?(&)
Evaluates the given block with self if this object is alive and valid in Godot's ObjectDB.
- #unbind_property_list_changed(callback : Proc(R)) : Bool forall R
- #unbind_property_list_changed(token : UInt64) : Bool
- #unbind_script_changed(callback : Proc(R)) : Bool forall R
- #unbind_script_changed(token : UInt64) : Bool
-
#unbind_static_signal(signal_name : String, callback : Proc(*T, R)) : Bool forall T, R
Unbinds a matching compile-time typed
Proc(*T, R)from this object'sStaticSignalTableslot. -
#unbind_static_signal(signal_name : Symbol, callback : Proc(*T, R)) : Bool forall T, R
Unbinds a matching compile-time typed
Proc(*T, R)from this object'sStaticSignalTableslot (Symbol overload). -
#unbind_static_signal(token : UInt64) : Bool
Unbinds a
StaticSignalTablelistener token.
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
Wraps a raw pointer returned by godot_ptrcall, reusing any live extension instance.
Overridden on Godot::RefCounted to adopt the +1 reference returned by PtrToArg<Ref<T>>::encode.
Class unary ~ returns typed instance looked up from active NodeContext (by name first, then searching children)
Class-level constructor configuring a new native Godot instance in a block
Instantiates a new native Godot object and configures it in a block
Class Method Detail
Checks if this object class overrides a generic virtual method.
Class-level casting helper raising TypeCastError
Discovers the .cr source file and 1-based line number corresponding to a custom node/resource class
Discovers a .cr source file corresponding to a custom node/class
Checks if a 64-bit instance ID is currently valid in Godot's ObjectDB
Returns true if the given class name is a built-in engine class, internal Lapis class, or UniBuilder brush class
Instance Method Detail
Value equality based on Godot engine identity (instance ID, underlying pointer, or reference identity)
Binds declarative class-level on_signal and @[OnSignal] callbacks to StaticSignalTable slots.
Invokes #_godot_bind_static_signals_impl synthesized by the node and gmodule macros.
Internal hook overridden by node and gmodule macros to bind compile-time typed procs to StaticSignalTable.
Dispatches inspector tool button clicks on this object.
Virtual method and property dispatch hooks overridden by class registration macros.
Delta timestep is received with 64-bit precision (Float64).
Dispatches generic virtual methods with raw arguments and return buffer.
Invoked by the GDExtension bridge when retrieving an exposed @export property.
Invoked by the GDExtension bridge when setting an exposed @export property.
Internal helper invoked by Bridge free_fn when Godot C++ deallocates a Crystal object.
Returns true if the object is active and not destroyed (works in both engine and standalone unit specs)
Returns true if this object instance has a valid engine pointer and is alive in Godot's ObjectDB
Populates @[Export] properties on this object from a Godot::Dictionary.
Re-wraps or downcasts this Godot object pointer to the requested Godot wrapper class T, raising TypeCastError if incompatible.
Re-wraps or downcasts this Godot object pointer to the requested Godot wrapper class T, verifying that the underlying native object inherits from T. Returns nil if invalid or incompatible.
Cooperatively awaits a signal emitted on this object.
Returns AwaitStatus(Array(Variant)) indicating completion or timeout.
Cooperatively awaits a signal emitted on this object, raising TimeoutError if timeout expires.
Cooperatively awaits a signal emitted on this object, returning nil if timeout expires.
Binds a compile-time typed Proc(*T, R) directly to this object's StaticSignalTable slot.
Binds a compile-time typed Proc(*T, R) directly to this object's StaticSignalTable slot (Symbol overload).
Fluent inline configuration block yielding self and returning self
Calls the named method on the object with an array of Variants.
Calls the named method on the object with variable arguments. If this wrapper points to a live Crystal subclass instance, dispatches polymorphically through it.
Calls the named method and returns the result as Bool
Calls the named method on the object during idle time.
Calls the named method and returns the result as Float64
Calls the named method and returns the result as Int64
Calls the named method and returns an Object/Node (or nil if null)
Calls the named method and returns the result cast to T (or nil if null)
Calls the named method and returns the result as String
Validates that the underlying engine object is still alive before executing bridge calls.
Raises DisposedObjectError if the object was destroyed by GDScript, engine, or Crystal.
Connects a callback proc to the named signal.
Connects a callback block accepting Array(Variant) to the named signal.
Connects a callback block to the named signal symbol.
Connects the named signal to a method call on a listener target by symbol name.
Connects a one-shot callback block to the named signal (backwards compatibility).
Disconnects all signal subscriptions for the named signal on this object.
Disconnects all subscriptions for the specified signal (Symbol overload)
Disconnects all subscriptions for the specified signal, returning self
Disconnects all subscriptions across ALL signals on this object, returning self
Emits the named signal with arguments, returning self
Emits a bound or typed signal with arguments, returning self
Emits a parameterless signal on this Godot object with zero GC heap allocations.
Emits a signal with variable arguments on this Godot object.
Emits a typed signal directly through StaticSignalTable.global with zero GC heap allocations.
Emits a typed signal directly through StaticSignalTable.global (Symbol overload).
Computes a deterministic 64-bit hash of all @[Export] properties on this object.
Returns the active Lapis::Core::FrameArena scratchpad for the current frame.
Executes a temporary scratch allocation scope on the current FrameArena
that automatically rewinds when the block finishes.
Allocates a per-frame scratch Slice(T) of count elements from FrameArena.current.
Overrides auto-generated raw Pointer(Void) metadata getter to avoid passing an 8-byte
stack Void* as a 24-byte Variant default argument in godot_ptrcall.
Retrieves boolean metadata stored on this object, or default if not set.
Retrieves floating-point metadata stored on this object as a Float64, or default if not set.
Example:
multiplier = node.get_meta_f64(:difficulty_multiplier)
Retrieves integer metadata stored on this object as an Int32, or default if not set.
Retrieves integer metadata stored on this object as an Int64, or default if not set.
Example:
tier = node.get_meta_i64(:enemy_tier)
Safely retrieves a Godot::Object from metadata by validating its 64-bit ObjectDB #instance_id
(or direct object Variant) and resolving any live Crystal subclass instance.
Retrieves string metadata stored on this object, or default if not set.
Example:
id = node.get_meta_str(:spawner_id)
Returns true if this object has metadata stored under key.
Example:
if node.has_meta(:quest_target)
highlight_target(node)
end
Checks both Crystal-defined methods on the live instance and native Godot methods.
Returns true if this object or its registered class defines the given signal.
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Automatically links this node's registered CrystalScript resource if running inside the Godot Editor
Resolves the live Crystal subclass instance registered for this native pointer, or returns self.
Returns true if the underlying engine pointer is non-null and currently valid
Identity setter enabling compound operator sugar (node.property_list_changed += ->handler, node.property_list_changed -= ->handler)
Fast check if this object is queued for deletion (queue_free) or already destroyed.
Explicitly rebinds all declarative on_signal and @[OnSignal] callbacks to StaticSignalTable slots.
Identity setter enabling compound operator sugar (node.script_changed += ->handler, node.script_changed -= ->handler)
Dynamically sets a property value on this object.
Sets arbitrary metadata on this object with automatic Variant conversion.
Supports both String and Symbol keys.
Example:
node.set_meta(:enemy_tier, 3)
node.set_meta("spawner_id", "wave_01")
Overrides auto-generated raw Pointer(Void) metadata setter so value is stored safely
as a 64-bit integer address via Variant::INT rather than passing an 8-byte stack Void*
to godot_ptrcall_void expecting a 24-byte Variant.
Safely stores a reference to a Godot::Object in metadata using its monotonic 64-bit ObjectDB #instance_id.
Passing nil or a disposed object removes the metadata entry.
Returns a bound signal representation for the named signal.
Enables idiomatic usage: enemy.signal("died").await or button.signal(:pressed).connect { ... }.
Returns a bound signal representation for the named signal symbol.
Returns the count of active subscriptions for the given signal on this object.
Identifier used for signal routing and lifecycle tracking (engine instance ID or Crystal object_id)
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Safe nil-coalescing check: returns self if alive in Godot's ObjectDB, otherwise nil.
Evaluates the given block with self if this object is alive and valid in Godot's ObjectDB. Returns nil if this object has been destroyed or freed, preventing dead pointer crashes.
Unbinds a matching compile-time typed Proc(*T, R) from this object's StaticSignalTable slot (Symbol overload).