Skip to main content

Resource

Inherits: RefCounted < Object

Description

Base class for serializable objects. Resources are reference-counted and freed when no longer in use. They can be nested within other resources and saved on disk.

Inheritance

Resource < RefCounted < Object

Properties

bool
default:"false"
If true, the resource is duplicated for each instance of all scenes using it.
String
default:""
An optional name for this resource. Displayed in the Inspector dock.
String
default:""
The unique path to this resource. If saved to disk, the value will be its filepath.

Methods

duplicate

Duplicates this resource, returning a new resource with its exported or PROPERTY_USAGE_STORAGE properties copied from the original.
bool
If true, performs a deep copy where nested arrays and resources are also duplicated

emit_changed

Emits the changed signal. Call this method whenever a meaningful change occurs.

take_over_path

Sets the resource_path to path, potentially overriding an existing cache entry.

Signals

changed()

Emitted when the resource changes, usually when one of its properties is modified.

Example Usage