Resource

    Inherited By: , AnimationNode, , AnimationNodeStateMachineTransition, , AudioEffect, , BakedLightmapData, , ButtonGroup, , Curve, , Curve3D, , EditorSettings, , Environment, , GDNativeLibrary, , Gradient, , InputEvent, , Mesh, , MultiMesh, , NavigationPolygon, , OpenSimplexNoise, , PackedScene, , PolygonPathFinder, , Shader, , Shape2D, , Sky, , StyleBox, , Texture, , Theme, , Translation, , VisualScriptNode, , World,

    Category: Core

    Base class for all resources.

    Properties

    Signals

    • changed ( )

    Emitted whenever the resource changes.

    Tutorials

    • resource_local_to_scene

    If , the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.


    The name of the resource. This is an optional identifier.


    The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.

    Method Descriptions

    • void _setup_local_to_scene ( ) virtual

    Virtual function which can be overridden to customize the behavior value of .


    • Resource duplicate ( subresources=false ) const

    • Node get_local_scene ( ) const

    If is enabled and the resource was loaded from a PackedScene instantiation, returns the local scene where this resource’s unique copy is in use. Otherwise, returns .


    • get_rid ( ) const

    Returns the RID of the resource (or an empty RID). Many resources (such as Texture, , etc) are high level abstractions of resources stored in a server, so this function will return the original RID.


    This method is called when a resource with resource_local_to_scene enabled is loaded from a instantiation. Its behavior can be customized by overriding _setup_local_to_scene from script.

    For most resources, this method performs no base logic. performs custom logic to properly set the proxy texture and flags in the local viewport.


    • void take_over_path ( String path )