Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

RID

Resource 的唯一标识符的句柄。

描述

The RID 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 DisplayServer, RenderingServer, TextServer, etc.

A low-level resource may correspond to a high-level Resource, such as Texture or 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.

备注

通过 C# 使用该 API 时会有显著不同,详见 C# API 与 GDScript 的差异

构造函数

RID

RID()

RID

RID(from: RID)

方法

int

get_id() const

bool

is_valid() const

运算符

bool

operator !=(right: RID)

bool

operator <(right: RID)

bool

operator <=(right: RID)

bool

operator ==(right: RID)

bool

operator >(right: RID)

bool

operator >=(right: RID)


构造函数说明

RID RID() 🔗

构造空的 RID,内容为无效的 ID 0


RID RID(from: RID)

构造给定 RID 的副本。


方法说明

int get_id() const 🔗

返回引用的底层资源的 ID。


bool is_valid() const 🔗

如果该 RID0,则返回 true


运算符说明

bool operator !=(right: RID) 🔗

如果 RID 不相等,则返回 true


bool operator <(right: RID) 🔗

如果该 RID 的 ID 小于右侧 right 的 ID,则返回 true


bool operator <=(right: RID) 🔗

如果该 RID 的 ID 小于等于右侧 right 的 ID,则返回 true


bool operator ==(right: RID) 🔗

如果 RID 相等,则返回 true,表示它们引用的是同一个底层资源。


bool operator >(right: RID) 🔗

如果该 RID 的 ID 大于右侧 right 的 ID,则返回 true


bool operator >=(right: RID) 🔗

如果该 RID 的 ID 大于等于右侧 right 的 ID,则返回 true