Base class for all non built-in types.
Base class for all non built-in types. Everything which is not a built-in type starts the inheritance chain from this class.
Objects can be constructed from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript.
Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++).
Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
Returns the given property. Returns [code]null[/code] if the [code]property[/code] does not exist.
Returns the object's property list as an [Array] of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]).
The virtual method called upon initialization.
Notify the object internally using an ID.
Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
Override this method to customize the [String] representation of the object when it's being converted to a string, for example: [code]print(obj)[/code].
Adds a user-defined [code]signal[/code]. Arguments are optional, but can be added as an [Array] of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*).
Calls the [code]method[/code] on the object and returns a result. Pass parameters as a comma separated list.
Calls the [code]method[/code] on the object during idle time and returns a result. Pass parameters as a comma separated list.
Calls the [code]method[/code] on the object and returns a result. Pass parameters as an [Array].
Returns [code]true[/code] if the object can translate strings.
Connects a [code]signal[/code] to a [code]method[/code] on a [code]target[/code] object. Pass optional [code]binds[/code] to the call. Use [code]flags[/code] to set deferred or one shot connections. See [code]CONNECT_*[/code] constants. A [code]signal[/code] can only be connected once to a [code]method[/code]. It will throw an error if already connected. To avoid this, first use [method is_connected] to check for existing connections.
Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code].
Emits the given [code]signal[/code].
Deletes the object from memory.
Returns a [Variant] for a [code]property[/code].
Returns the object's class as a [String].
Returns an [Array] of dictionaries with information about signals that are connected to the object.
Inside each [Dictionary] there are 3 fields:
- "source" is a reference to signal emitter.
- "signal_name" is name of connected signal.
- "method_name" is a name of method to which signal is connected.
Get indexed object property by String.
Property indices get accessed with colon separation, for example: [code]position:x[/code]
Returns the object's unique instance ID.
Returns the object's metadata for the given [code]name[/code].
Returns the object's metadata as a [PoolStringArray].
Returns the object's methods and their signatures as an [Array].
Returns the list of properties as an [Array] of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]).
Returns the object's [Script] or [code]null[/code] if one doesn't exist.
Returns an [Array] of connections for the given [code]signal[/code].
Returns the list of signals as an [Array] of dictionaries.
Returns [code]true[/code] if a metadata is found with the given [code]name[/code].
Returns [code]true[/code] if the object contains the given [code]method[/code].
Returns [code]true[/code] if the given user-defined [code]signal[/code] exists.
Returns [code]true[/code] if signal emission blocking is enabled.
Returns [code]true[/code] if the object inherits from the given [code]type[/code].
Returns [code]true[/code] if a connection exists for a given [code]signal[/code], [code]target[/code], and [code]method[/code].
Returns [code]true[/code] if the [code]queue_free[/code] method was called for the object.
Notify the object of something.
Set property into the object.
If set to [code]true[/code], signal emission is blocked.
Define whether the object can translate strings (with calls to [method tr]). Default is [code]true[/code].
Set a metadata into the object. Metadata is serialized. Metadata can be [i]anything[/i].
Set a script into the object, scripts extend the object functionality.
Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
Override the method [method _to_string] to customize the [String] representation.
Translate a message. Only works if message translation is enabled (which it is by default). See [method set_message_translation].
Emitted whenever the script of the Object is changed.
Called right when the object is initialized. Not available in script.
Called before the object is about to be deleted.
Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time.
Persisting connections are saved when the object is serialized to file.
One shot connections disconnect themselves after emission.