github_url: | hide |
---|
Inherits: :ref:`Node<class_Node>` < :ref:`Object<class_Object>`
Resource Preloader Node.
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.
GDScript has a simplified :ref:`@GDScript.preload<class_@GDScript_method_preload>` built-in method which can be used in most situations, leaving the use of ResourcePreloader
for more advanced scenarios.
- void add_resource ( :ref:`StringName<class_StringName>` name, :ref:`Resource<class_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.
- :ref:`Resource<class_Resource>` get_resource ( :ref:`StringName<class_StringName>` name ) const
Returns the resource associated to name
.
- :ref:`PackedStringArray<class_PackedStringArray>` get_resource_list ( ) const
Returns the list of resources inside the preloader.
- :ref:`bool<class_bool>` has_resource ( :ref:`StringName<class_StringName>` name ) const
Returns true
if the preloader contains a resource associated to name
.
- void remove_resource ( :ref:`StringName<class_StringName>` name )
Removes the resource associated to name
from the preloader.
- void rename_resource ( :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` newname )
Renames a resource inside the preloader from name
to newname
.