Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

RID

Resource 的唯一标识符的句柄。

描述

RID Variant 类型用于通过其唯一 ID 访问低级资源。RID 是不透明的,这意味着它们不会自行授予对资源的访问权限。它们由低级服务类使用,例如 DisplayServerRenderingServerTextServer 等。

低级资源可能对应于高级 Resource,例如 TextureMesh

备注

通过 C# 使用这个 API 时有显著的不同。详见 C# API 与 GDScript 的差异

构造函数

RID

RID ( )

RID

RID ( RID from )

方法

int

get_id ( ) const

bool

is_valid ( ) const

操作符

bool

operator != ( RID right )

bool

operator < ( RID right )

bool

operator <= ( RID right )

bool

operator == ( RID right )

bool

operator > ( RID right )

bool

operator >= ( RID right )


构造函数说明

RID RID ( )

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


RID RID ( RID from )

构造给定 RID 的副本。


方法说明

int get_id ( ) const

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


bool is_valid ( ) const

如果该 RID0,则返回 true


操作符说明

bool operator != ( RID right )

如果 RID 不相等,则返回 true


bool operator < ( RID right )

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


bool operator <= ( RID right )

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


bool operator == ( RID right )

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


bool operator > ( RID right )

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


bool operator >= ( RID right )

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