Script.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Script" inherits="Resource" category="Core" version="3.1">
  3. <brief_description>
  4. A class stored as a resource.
  5. </brief_description>
  6. <description>
  7. A class stored as a resource. A script exends the functionality of all objects that instance it.
  8. The [code]new[/code] method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
  9. </description>
  10. <tutorials>
  11. <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/scripting.html</link>
  12. </tutorials>
  13. <demos>
  14. </demos>
  15. <methods>
  16. <method name="can_instance" qualifiers="const">
  17. <return type="bool">
  18. </return>
  19. <description>
  20. Returns [code]true[/code] if the script can be instanced.
  21. </description>
  22. </method>
  23. <method name="get_base_script" qualifiers="const">
  24. <return type="Script">
  25. </return>
  26. <description>
  27. Returns the script directly inherited by this script.
  28. </description>
  29. </method>
  30. <method name="get_instance_base_type" qualifiers="const">
  31. <return type="String">
  32. </return>
  33. <description>
  34. Returns the script's base type.
  35. </description>
  36. </method>
  37. <method name="has_script_signal" qualifiers="const">
  38. <return type="bool">
  39. </return>
  40. <argument index="0" name="signal_name" type="String">
  41. </argument>
  42. <description>
  43. Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
  44. </description>
  45. </method>
  46. <method name="has_source_code" qualifiers="const">
  47. <return type="bool">
  48. </return>
  49. <description>
  50. Returns [code]true[/code] if the script contains non-empty source code.
  51. </description>
  52. </method>
  53. <method name="instance_has" qualifiers="const">
  54. <return type="bool">
  55. </return>
  56. <argument index="0" name="base_object" type="Object">
  57. </argument>
  58. <description>
  59. Returns [code]true[/code] if [code]base_object[/code] is an instance of this script.
  60. </description>
  61. </method>
  62. <method name="is_tool" qualifiers="const">
  63. <return type="bool">
  64. </return>
  65. <description>
  66. Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
  67. </description>
  68. </method>
  69. <method name="reload">
  70. <return type="int" enum="Error">
  71. </return>
  72. <argument index="0" name="keep_state" type="bool" default="false">
  73. </argument>
  74. <description>
  75. Reloads the script's class implementation. Returns an error code.
  76. </description>
  77. </method>
  78. </methods>
  79. <members>
  80. <member name="source_code" type="String" setter="set_source_code" getter="get_source_code">
  81. The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.
  82. </member>
  83. </members>
  84. <constants>
  85. </constants>
  86. </class>