.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.

.. _class_Resource:

Resource
========

**Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`

**Inherited By:** :ref:`Theme<class_theme>`, :ref:`AudioStream<class_audiostream>`, :ref:`EventStream<class_eventstream>`, :ref:`CubeMap<class_cubemap>`, :ref:`Translation<class_translation>`, :ref:`Curve2D<class_curve2d>`, :ref:`Shape<class_shape>`, :ref:`Shape2D<class_shape2d>`, :ref:`BakedLight<class_bakedlight>`, :ref:`ColorRamp<class_colorramp>`, :ref:`StyleBox<class_stylebox>`, :ref:`Environment<class_environment>`, :ref:`Material<class_material>`, :ref:`VideoStream<class_videostream>`, :ref:`RoomBounds<class_roombounds>`, :ref:`PackedScene<class_packedscene>`, :ref:`Texture<class_texture>`, :ref:`Script<class_script>`, :ref:`OccluderPolygon2D<class_occluderpolygon2d>`, :ref:`Mesh<class_mesh>`, :ref:`TileSet<class_tileset>`, :ref:`BitMap<class_bitmap>`, :ref:`Animation<class_animation>`, :ref:`Sample<class_sample>`, :ref:`PolygonPathFinder<class_polygonpathfinder>`, :ref:`Shader<class_shader>`, :ref:`World<class_world>`, :ref:`SampleLibrary<class_samplelibrary>`, :ref:`World2D<class_world2d>`, :ref:`Font<class_font>`, :ref:`SpriteFrames<class_spriteframes>`, :ref:`MeshLibrary<class_meshlibrary>`, :ref:`Curve3D<class_curve3d>`, :ref:`NavigationPolygon<class_navigationpolygon>`, :ref:`MultiMesh<class_multimesh>`, :ref:`CanvasItemMaterial<class_canvasitemmaterial>`, :ref:`PackedDataContainer<class_packeddatacontainer>`, :ref:`NavigationMesh<class_navigationmesh>`

**Category:** Core

Brief Description
-----------------

Base class for all resources.

Member Functions
----------------

+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`set_path<class_Resource_set_path>`  **(** :ref:`String<class_string>` path  **)**                           |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`take_over_path<class_Resource_take_over_path>`  **(** :ref:`String<class_string>` path  **)**               |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>`  | :ref:`get_path<class_Resource_get_path>`  **(** **)** const                                                       |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`set_name<class_Resource_set_name>`  **(** :ref:`String<class_string>` name  **)**                           |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>`  | :ref:`get_name<class_Resource_get_name>`  **(** **)** const                                                       |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_rid>`        | :ref:`get_rid<class_Resource_get_rid>`  **(** **)** const                                                         |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`set_import_metadata<class_Resource_set_import_metadata>`  **(** :ref:`Object<class_object>` metadata  **)** |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_object>`  | :ref:`get_import_metadata<class_Resource_get_import_metadata>`  **(** **)** const                                 |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_object>`  | :ref:`duplicate<class_Resource_duplicate>`  **(** :ref:`bool<class_bool>` subresources=false  **)**               |
+------------------------------+-------------------------------------------------------------------------------------------------------------------+

Signals
-------

-  **changed**  **(** **)**

Description
-----------

Resource is the base class for all resource types. Resources are primarily data containers. They are reference counted and freed when no longer in use. They are also loaded only once from disk, and further attempts to load the resource will return the same reference (all this in contrast to a :ref:`Node<class_node>`, which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a :ref:`Node<class_node>` or another resource.

Member Function Description
---------------------------

.. _class_Resource_set_path:

- void  **set_path**  **(** :ref:`String<class_string>` path  **)**

Set the path of the resource. This is useful mainly for editors when saving/loading, and shouldn't be changed by anything else.

.. _class_Resource_take_over_path:

- void  **take_over_path**  **(** :ref:`String<class_string>` path  **)**

.. _class_Resource_get_path:

- :ref:`String<class_string>`  **get_path**  **(** **)** const

Return the path of the resource. This is useful mainly for editors when saving/loading, and shouldn't be changed by anything else.

.. _class_Resource_set_name:

- void  **set_name**  **(** :ref:`String<class_string>` name  **)**

Set the name of the resources, any name is valid (it doesn't have to be unique). Name is for descriptive purposes only.

.. _class_Resource_get_name:

- :ref:`String<class_string>`  **get_name**  **(** **)** const

Return the name of the resources, any name is valid (it doesn't have to be unique). Name is for descriptive purposes only.

.. _class_Resource_get_rid:

- :ref:`RID<class_rid>`  **get_rid**  **(** **)** const

Return the RID of the resource (or an empty RID). Many resources (such as :ref:`Texture<class_texture>`, :ref:`Mesh<class_mesh>`, etc) are high level abstractions of resources stored in a server, so this function will return the original RID.

.. _class_Resource_set_import_metadata:

- void  **set_import_metadata**  **(** :ref:`Object<class_object>` metadata  **)**

.. _class_Resource_get_import_metadata:

- :ref:`Object<class_object>`  **get_import_metadata**  **(** **)** const

.. _class_Resource_duplicate:

- :ref:`Object<class_object>`  **duplicate**  **(** :ref:`bool<class_bool>` subresources=false  **)**


