Files
godot-docs/classes/class_rid.rst
2025-06-28 03:33:31 +00:00

222 lines
7.9 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/RID.xml.
.. _class_RID:
RID
===
A handle for a :ref:`Resource<class_Resource>`'s unique identifier.
.. rst-class:: classref-introduction-group
Description
-----------
The RID :ref:`Variant<class_Variant>` type is used to access a low-level resource by its unique ID. RIDs are opaque, which means they do not grant access to the resource by themselves. They are used by the low-level server classes, such as :ref:`DisplayServer<class_DisplayServer>`, :ref:`RenderingServer<class_RenderingServer>`, :ref:`TextServer<class_TextServer>`, etc.
A low-level resource may correspond to a high-level :ref:`Resource<class_Resource>`, such as :ref:`Texture<class_Texture>` or :ref:`Mesh<class_Mesh>`.
\ **Note:** RIDs are only useful during the current session. It won't correspond to a similar resource if sent over a network, or loaded from a file at a later time.
.. note::
There are notable differences when using this API with C#. See :ref:`doc_c_sharp_differences` for more information.
.. rst-class:: classref-reftable-group
Constructors
------------
.. table::
:widths: auto
+-----------------------+---------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`RID<class_RID_constructor_RID>`\ (\ ) |
+-----------------------+---------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`RID<class_RID_constructor_RID>`\ (\ from\: :ref:`RID<class_RID>`\ ) |
+-----------------------+---------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------+----------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_id<class_RID_method_get_id>`\ (\ ) |const| |
+-------------------------+----------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_valid<class_RID_method_is_valid>`\ (\ ) |const| |
+-------------------------+----------------------------------------------------------+
.. rst-class:: classref-reftable-group
Operators
---------
.. table::
:widths: auto
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator !=<class_RID_operator_neq_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator \<<class_RID_operator_lt_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator \<=<class_RID_operator_lte_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator ==<class_RID_operator_eq_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator ><class_RID_operator_gt_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator >=<class_RID_operator_gte_RID>`\ (\ right\: :ref:`RID<class_RID>`\ ) |
+-------------------------+--------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Constructor Descriptions
------------------------
.. _class_RID_constructor_RID:
.. rst-class:: classref-constructor
:ref:`RID<class_RID>` **RID**\ (\ ) :ref:`🔗<class_RID_constructor_RID>`
Constructs an empty **RID** with the invalid ID ``0``.
.. rst-class:: classref-item-separator
----
.. rst-class:: classref-constructor
:ref:`RID<class_RID>` **RID**\ (\ from\: :ref:`RID<class_RID>`\ )
Constructs an **RID** as a copy of the given **RID**.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_RID_method_get_id:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_id**\ (\ ) |const| :ref:`🔗<class_RID_method_get_id>`
Returns the ID of the referenced low-level resource.
.. rst-class:: classref-item-separator
----
.. _class_RID_method_is_valid:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_valid**\ (\ ) |const| :ref:`🔗<class_RID_method_is_valid>`
Returns ``true`` if the **RID** is not ``0``.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Operator Descriptions
---------------------
.. _class_RID_operator_neq_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_neq_RID>`
Returns ``true`` if the **RID**\ s are not equal.
.. rst-class:: classref-item-separator
----
.. _class_RID_operator_lt_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator <**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_lt_RID>`
Returns ``true`` if the **RID**'s ID is less than ``right``'s ID.
.. rst-class:: classref-item-separator
----
.. _class_RID_operator_lte_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator <=**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_lte_RID>`
Returns ``true`` if the **RID**'s ID is less than or equal to ``right``'s ID.
.. rst-class:: classref-item-separator
----
.. _class_RID_operator_eq_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator ==**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_eq_RID>`
Returns ``true`` if both **RID**\ s are equal, which means they both refer to the same low-level resource.
.. rst-class:: classref-item-separator
----
.. _class_RID_operator_gt_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator >**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_gt_RID>`
Returns ``true`` if the **RID**'s ID is greater than ``right``'s ID.
.. rst-class:: classref-item-separator
----
.. _class_RID_operator_gte_RID:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator >=**\ (\ right\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_RID_operator_gte_RID>`
Returns ``true`` if the **RID**'s ID is greater than or equal to ``right``'s ID.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`