github_url: | hide |
---|
A handle for a :ref:`Resource<class_Resource>`'s unique identifier.
.. rst-class:: classref-introduction-group
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
: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
: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
.. rst-class:: classref-section-separator
.. rst-class:: classref-descriptions-group
.. 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 a RID as a copy of the given RID.
.. rst-class:: classref-section-separator
.. rst-class:: classref-descriptions-group
.. 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
.. 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
.. rst-class:: classref-operator
:ref:`bool<class_bool>` operator !=(right: :ref:`RID<class_RID>`) :ref:`🔗<class_RID_operator_neq_RID>`
Returns true
if the RIDs are not equal.
.. rst-class:: classref-item-separator
.. 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
.. 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
.. rst-class:: classref-operator
:ref:`bool<class_bool>` operator ==(right: :ref:`RID<class_RID>`) :ref:`🔗<class_RID_operator_eq_RID>`
Returns true
if both RIDs are equal, which means they both refer to the same low-level resource.
.. rst-class:: classref-item-separator
.. 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
.. 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.