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.

Note: In a boolean context, an RID will evaluate to false if it has the invalid ID 0. Otherwise, an RID will always evaluate to true. This is equivalent to calling is_valid().

備註

使用 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)

Constructs an RID as a copy of the given 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