ResourcePreloader
Description
Section titled “Description”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.
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | add_resource(name: StringName, resource: Resource) |
| Resource | get_resource(name: StringName) const |
| PackedStringArray | get_resource_list() const |
| bool | has_resource(name: StringName) const |
| void | remove_resource(name: StringName) |
| void | rename_resource(name: StringName, newname: StringName) |
Method descriptions
Section titled “Method descriptions”add_resource
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.
get_resource
Resource get_resource(name: StringName) const
Returns the resource associated to name.
get_resource_list
PackedStringArray get_resource_list() const
Returns the list of resources inside the preloader.
has_resource
bool has_resource(name: StringName) const
Returns true if the preloader contains a resource associated to name.
remove_resource
void remove_resource(name: StringName)
Removes the resource associated to name from the preloader.
rename_resource
void rename_resource(name: StringName, newname: StringName)
Renames a resource inside the preloader from name to newname.
