ResourcePreloader
A node used to preload sub-resources inside a scene.
描述
This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. You can add the resources using the ResourcePreloader tab when the node is selected.
GDScript has a simplified @GDScript.preload
built-in method which can be used in most situations, leaving the use of ResourcePreloader for more advanced scenarios.
方法
void | add_resource ( name: StringName , resource: Resource ) |
Resource | get_resource ( name: StringName ) const1 |
PackedStringArray | get_resource_list ( ) const1 |
bool | has_resource ( name: StringName ) const1 |
void | remove_resource ( name: StringName ) |
void | rename_resource ( name: StringName , newname: StringName ) |
方法说明
void
add_resource ( name: StringName
, resource: Resource
)
Adds a resource to the preloader with the given name
. If a resource with the given name
already exists, the new resource will be renamed to "name
N" where N is an incrementing number starting from 2.
Resource
get_resource ( name: StringName
) const1
Returns the resource associated to name
.
PackedStringArray
get_resource_list ( ) const1
Returns the list of resources inside the preloader.
bool
has_resource ( name: StringName
) const1
Returns true
if the preloader contains a resource associated to name
.
void
remove_resource ( name: StringName
)
Removes the resource associated to name
from the preloader.
void
rename_resource ( name: StringName
, newname: StringName
)
Renames a resource inside the preloader from name
to newname
.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。