Virtual method which can be overridden to customize the return value of get. Returns the given property. Returns null if the property does not exist.
Virtual method which can be overridden to customize the return value of getPropertyList. Returns the object's property list as an Array of dictionaries. Each property's Dictionary must contain at least name: String and type: int (see Variant.type) entries. Optionally, it can also include hint: int (see propertyhint), hint_string: String, and usage: int (see propertyusageflags).
Called when the object is initialized.
Called whenever the object receives a notification, which is identified in what by a constant. The base GodotObject has two constants constant NOTIFICATION_POSTINITIALIZE and constant NOTIFICATION_PREDELETE, but subclasses such as Node define a lot more notifications which are also received by this method.
Virtual method which can be overridden to customize the return value of set. Sets a property. Returns true if the property exists.
Virtual method which can be overridden to customize the return value of toString, and thus the object's representation where it is converted to a string, e.g. with print(obj). Returns a String representing the object. If not overridden, defaults to "$(D ClassName:RID)".
Adds a user-defined signal. Arguments are optional, but can be added as an Array of dictionaries, each containing name: String and type: int (see Variant.type) entries.
Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
Calls the method on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
Calls the method on the object and returns the result. Contrarily to call, this method does not support a variable number of arguments but expects all parameters to be via a single Array.
Returns true if the object can translate strings. See setMessageTranslation and tr.
Connects a signal to a method on a target object. Pass optional binds to the call as an Array of parameters. These parameters will be passed to the method after any parameter used in the call to emitSignal. Use flags to set deferred or one-shot connections. See connectflags constants. A signal can only be connected once to a method. It will throw an error if already connected, unless the signal was connected with constant CONNECT_REFERENCE_COUNTED. To avoid this, first, use isConnected to check for existing connections. If the target is destroyed in the game's lifecycle, the connection will be lost.
Disconnects a signal from a method on the given target. If you try to disconnect a connection that does not exist, the method will throw an error. Use isConnected to ensure that the connection exists.
Emits the given signal. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
Deletes the object from memory immediately. For Nodes, you may want to use Node.queueFree to queue the node for safe deletion at the end of the current frame. Important: If you have a variable pointing to an object, it will not be assigned to null once the object is freed. Instead, it will point to a previously freed instance and you should validate it with @GDScript.isInstanceValid before attempting to call its methods or access its properties.
Returns the Variant value of the given property. If the property doesn't exist, this will return null. Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
Returns the object's class as a String.
Returns an Array of dictionaries with information about signals that are connected to the object. Each Dictionary contains three String entries: - source is a reference to the signal emitter. - signal_name is the name of the connected signal. - method_name is the name of the method to which the signal is connected.
Gets the object's property indexed by the given NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Examples: "position:x" or "material:next_pass:blend_mode".
Returns the object's unique instance ID. This ID can be saved in EncodedObjectAsID, and can be used to retrieve the object instance with @GDScript.instanceFromId.
Returns the object's metadata entry for the given name.
Returns the object's metadata as a PoolStringArray.
Returns the object's methods and their signatures as an Array.
Returns the object's property list as an Array of dictionaries. Each property's Dictionary contain at least name: String and type: int (see Variant.type) entries. Optionally, it can also include hint: int (see propertyhint), hint_string: String, and usage: int (see propertyusageflags).
Returns the object's Script instance, or null if none is assigned.
Returns an Array of connections for the given signal.
Returns the list of signals as an Array of dictionaries.
Returns true if a metadata entry is found with the given name.
Returns true if the object contains the given method.
Returns true if the given signal exists.
Returns true if the given user-defined signal exists. Only signals added using addUserSignal are taken into account.
Returns true if signal emission blocking is enabled.
Returns true if the object inherits from the given class.
Returns true if a connection exists for a given signal, target, and method.
Returns true if the Node.queueFree method was called for the object.
Send a given notification to the object, which will also trigger a call to the _notification method of all classes that the object inherits from. If reversed is true, _notification is called first on the object's own class, and then up to its successive parent classes. If reversed is false, _notification is called first on the highest ancestor (GodotObject itself), and then down to its successive inheriting classes.
Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
Removes a given entry from the object's metadata. See also setMeta.
Assigns a new value to the given property. If the property does not exist, nothing will happen. Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
If set to true, signal emission is blocked.
Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling set via callDeferred, i.e. call_deferred("set", property, value). Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
Assigns a new value to the property identified by the NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Example:
Defines whether the object can translate strings (with calls to tr). Enabled by default.
Adds, changes or removes a given entry in the object's metadata. Metadata are serialized and can take any Variant value. To remove a given entry from the object's metadata, use removeMeta. Metadata is also removed if its value is set to null. This means you can also use set_meta("name", null) to remove metadata for "name".
Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality. If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script's _init method will be called.
Returns a String representing the object. If not overridden, defaults to "$(D ClassName:RID)". Override the method _toString to customize the String representation.
Translates a message using translation catalogs configured in the Project Settings. Only works if message translation is enabled (which it is by default), otherwise it returns the message unchanged. See setMessageTranslation.
Construct a new instance of GodotObject. Note: use memnew!GodotObject instead.
var n = Node2D.new() print("position" in n) # Prints "True". print("other_property" in n) # Prints "False".
The in operator will evaluate to true as long as the key exists, even if the value is null. Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See _notification. Note: Unlike references to a Reference, references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use Reference for data classes instead of GodotObject. Note: Due to a bug, you can't create a "plain" Object using Object.new(). Instead, use ClassDB.instance("Object"). This bug only applies to Object itself, not any of its descendents like Reference.
Base class for all non-built-in types.
Every class which is not a built-in type inherits from this class. You can construct Objects from scripting languages, using Object.new() in GDScript, new Object in C#, or the "Construct Object" node in VisualScript. Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the free method from your script or delete the instance from C++. Some classes that extend Object add memory management. This is the case of Reference, which counts references and deletes itself automatically when no longer referenced. Node, another fundamental type, deletes all its children when freed from memory. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in _getPropertyList and handled in _get and _set. However, scripting languages and C++ have simpler means to export them. Property membership can be tested directly in GDScript using in: