class_resourcepreloader.rst 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ResourcePreloader.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ResourcePreloader:
  6. ResourcePreloader
  7. =================
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Resource Preloader Node.
  10. Description
  11. -----------
  12. 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.
  13. 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.
  14. Methods
  15. -------
  16. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_resource<class_ResourcePreloader_method_add_resource>` **(** :ref:`String<class_String>` name, :ref:`Resource<class_Resource>` resource **)** |
  18. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Resource<class_Resource>` | :ref:`get_resource<class_ResourcePreloader_method_get_resource>` **(** :ref:`String<class_String>` name **)** |const| |
  20. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_resource_list<class_ResourcePreloader_method_get_resource_list>` **(** **)** |const| |
  22. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`has_resource<class_ResourcePreloader_method_has_resource>` **(** :ref:`String<class_String>` name **)** |const| |
  24. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`remove_resource<class_ResourcePreloader_method_remove_resource>` **(** :ref:`String<class_String>` name **)** |
  26. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`rename_resource<class_ResourcePreloader_method_rename_resource>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` newname **)** |
  28. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. Method Descriptions
  30. -------------------
  31. .. _class_ResourcePreloader_method_add_resource:
  32. - void **add_resource** **(** :ref:`String<class_String>` name, :ref:`Resource<class_Resource>` resource **)**
  33. 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.
  34. ----
  35. .. _class_ResourcePreloader_method_get_resource:
  36. - :ref:`Resource<class_Resource>` **get_resource** **(** :ref:`String<class_String>` name **)** |const|
  37. Returns the resource associated to ``name``.
  38. ----
  39. .. _class_ResourcePreloader_method_get_resource_list:
  40. - :ref:`PoolStringArray<class_PoolStringArray>` **get_resource_list** **(** **)** |const|
  41. Returns the list of resources inside the preloader.
  42. ----
  43. .. _class_ResourcePreloader_method_has_resource:
  44. - :ref:`bool<class_bool>` **has_resource** **(** :ref:`String<class_String>` name **)** |const|
  45. Returns ``true`` if the preloader contains a resource associated to ``name``.
  46. ----
  47. .. _class_ResourcePreloader_method_remove_resource:
  48. - void **remove_resource** **(** :ref:`String<class_String>` name **)**
  49. Removes the resource associated to ``name`` from the preloader.
  50. ----
  51. .. _class_ResourcePreloader_method_rename_resource:
  52. - void **rename_resource** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` newname **)**
  53. Renames a resource inside the preloader from ``name`` to ``newname``.
  54. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  55. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  56. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`