ResourcePreloader.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ResourcePreloader" inherits="Node" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Resource Preloader Node.
  5. </brief_description>
  6. <description>
  7. 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.
  8. GDScript has a simplified [method @GDScript.preload] built-in method which can be used in most situations, leaving the use of [ResourcePreloader] for more advanced scenarios.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_resource">
  14. <return type="void" />
  15. <argument index="0" name="name" type="String" />
  16. <argument index="1" name="resource" type="Resource" />
  17. <description>
  18. Adds a resource to the preloader with the given [code]name[/code]. If a resource with the given [code]name[/code] already exists, the new resource will be renamed to "[code]name[/code] N" where N is an incrementing number starting from 2.
  19. </description>
  20. </method>
  21. <method name="get_resource" qualifiers="const">
  22. <return type="Resource" />
  23. <argument index="0" name="name" type="String" />
  24. <description>
  25. Returns the resource associated to [code]name[/code].
  26. </description>
  27. </method>
  28. <method name="get_resource_list" qualifiers="const">
  29. <return type="PoolStringArray" />
  30. <description>
  31. Returns the list of resources inside the preloader.
  32. </description>
  33. </method>
  34. <method name="has_resource" qualifiers="const">
  35. <return type="bool" />
  36. <argument index="0" name="name" type="String" />
  37. <description>
  38. Returns [code]true[/code] if the preloader contains a resource associated to [code]name[/code].
  39. </description>
  40. </method>
  41. <method name="remove_resource">
  42. <return type="void" />
  43. <argument index="0" name="name" type="String" />
  44. <description>
  45. Removes the resource associated to [code]name[/code] from the preloader.
  46. </description>
  47. </method>
  48. <method name="rename_resource">
  49. <return type="void" />
  50. <argument index="0" name="name" type="String" />
  51. <argument index="1" name="newname" type="String" />
  52. <description>
  53. Renames a resource inside the preloader from [code]name[/code] to [code]newname[/code].
  54. </description>
  55. </method>
  56. </methods>
  57. <constants>
  58. </constants>
  59. </class>