class_node.rst 125 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Node.xml.
  6. .. _class_Node:
  7. Node
  8. ====
  9. **Inherits:** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`AnimationPlayer<class_AnimationPlayer>`, :ref:`AnimationTree<class_AnimationTree>`, :ref:`AnimationTreePlayer<class_AnimationTreePlayer>`, :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`, :ref:`CanvasItem<class_CanvasItem>`, :ref:`CanvasLayer<class_CanvasLayer>`, :ref:`EditorFileSystem<class_EditorFileSystem>`, :ref:`EditorInterface<class_EditorInterface>`, :ref:`EditorPlugin<class_EditorPlugin>`, :ref:`EditorResourcePreview<class_EditorResourcePreview>`, :ref:`HTTPRequest<class_HTTPRequest>`, :ref:`InstancePlaceholder<class_InstancePlaceholder>`, :ref:`NavigationAgent<class_NavigationAgent>`, :ref:`NavigationAgent2D<class_NavigationAgent2D>`, :ref:`NavigationObstacle<class_NavigationObstacle>`, :ref:`NavigationObstacle2D<class_NavigationObstacle2D>`, :ref:`ResourcePreloader<class_ResourcePreloader>`, :ref:`SkeletonIK<class_SkeletonIK>`, :ref:`Spatial<class_Spatial>`, :ref:`Timer<class_Timer>`, :ref:`Tween<class_Tween>`, :ref:`Viewport<class_Viewport>`, :ref:`WorldEnvironment<class_WorldEnvironment>`
  11. Base class for all *scene* objects.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Nodes are Godot's building blocks. They can be assigned as the child of another node, resulting in a tree arrangement. A given node can contain any number of nodes as children with the requirement that all siblings (direct children of a node) should have unique names.
  16. A tree of nodes is called a *scene*. Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of Godot projects.
  17. \ **Scene tree:** The :ref:`SceneTree<class_SceneTree>` contains the active tree of nodes. When a node is added to the scene tree, it receives the :ref:`NOTIFICATION_ENTER_TREE<class_Node_constant_NOTIFICATION_ENTER_TREE>` notification and its :ref:`_enter_tree<class_Node_method__enter_tree>` callback is triggered. Child nodes are always added *after* their parent node, i.e. the :ref:`_enter_tree<class_Node_method__enter_tree>` callback of a parent node will be triggered before its child's.
  18. Once all nodes have been added in the scene tree, they receive the :ref:`NOTIFICATION_READY<class_Node_constant_NOTIFICATION_READY>` notification and their respective :ref:`_ready<class_Node_method__ready>` callbacks are triggered. For groups of nodes, the :ref:`_ready<class_Node_method__ready>` callback is called in reverse order, starting with the children and moving up to the parent nodes.
  19. This means that when adding a node to the scene tree, the following order will be used for the callbacks: :ref:`_enter_tree<class_Node_method__enter_tree>` of the parent, :ref:`_enter_tree<class_Node_method__enter_tree>` of the children, :ref:`_ready<class_Node_method__ready>` of the children and finally :ref:`_ready<class_Node_method__ready>` of the parent (recursively for the entire scene tree).
  20. \ **Processing:** Nodes can override the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback :ref:`_process<class_Node_method__process>`, toggled with :ref:`set_process<class_Node_method_set_process>`) happens as fast as possible and is dependent on the frame rate, so the processing time *delta* (in seconds) is passed as an argument. Physics processing (callback :ref:`_physics_process<class_Node_method__physics_process>`, toggled with :ref:`set_physics_process<class_Node_method_set_physics_process>`) happens a fixed number of times per second (60 by default) and is useful for code related to the physics engine.
  21. Nodes can also process input events. When present, the :ref:`_input<class_Node_method__input>` function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the :ref:`_unhandled_input<class_Node_method__unhandled_input>` function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI :ref:`Control<class_Control>` nodes), ensuring that the node only receives the events that were meant for it.
  22. To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with the :ref:`owner<class_Node_property_owner>` property. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though.
  23. Finally, when a node is freed with :ref:`Object.free<class_Object_method_free>` or :ref:`queue_free<class_Node_method_queue_free>`, it will also free all its children.
  24. \ **Groups:** Nodes can be added to as many groups as you want to be easy to manage, you could create groups like "enemies" or "collectables" for example, depending on your game. See :ref:`add_to_group<class_Node_method_add_to_group>`, :ref:`is_in_group<class_Node_method_is_in_group>` and :ref:`remove_from_group<class_Node_method_remove_from_group>`. You can then retrieve all nodes in these groups, iterate them and even call methods on groups via the methods on :ref:`SceneTree<class_SceneTree>`.
  25. \ **Networking with nodes:** After connecting to a server (or making one, see :ref:`NetworkedMultiplayerENet<class_NetworkedMultiplayerENet>`), it is possible to use the built-in RPC (remote procedure call) system to communicate over the network. By calling :ref:`rpc<class_Node_method_rpc>` with a method name, it will be called locally and in all connected peers (peers = clients and the server that accepts connections). To identify which node receives the RPC call, Godot will use its :ref:`NodePath<class_NodePath>` (make sure node names are the same on all peers). Also, take a look at the high-level networking tutorial and corresponding demos.
  26. .. rst-class:: classref-introduction-group
  27. Tutorials
  28. ---------
  29. - :doc:`Nodes and Scenes <../getting_started/step_by_step/nodes_and_scenes>`
  30. - `All Demos <https://github.com/godotengine/godot-demo-projects/>`__
  31. .. rst-class:: classref-reftable-group
  32. Properties
  33. ----------
  34. .. table::
  35. :widths: auto
  36. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  37. | :ref:`MultiplayerAPI<class_MultiplayerAPI>` | :ref:`custom_multiplayer<class_Node_property_custom_multiplayer>` | |
  38. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  39. | :ref:`String<class_String>` | :ref:`filename<class_Node_property_filename>` | |
  40. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  41. | :ref:`MultiplayerAPI<class_MultiplayerAPI>` | :ref:`multiplayer<class_Node_property_multiplayer>` | |
  42. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  43. | :ref:`String<class_String>` | :ref:`name<class_Node_property_name>` | |
  44. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  45. | :ref:`Node<class_Node>` | :ref:`owner<class_Node_property_owner>` | |
  46. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  47. | :ref:`PauseMode<enum_Node_PauseMode>` | :ref:`pause_mode<class_Node_property_pause_mode>` | ``0`` |
  48. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  49. | :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` | :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>` | ``0`` |
  50. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  51. | :ref:`int<class_int>` | :ref:`process_priority<class_Node_property_process_priority>` | ``0`` |
  52. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  53. | :ref:`bool<class_bool>` | :ref:`unique_name_in_owner<class_Node_property_unique_name_in_owner>` | ``false`` |
  54. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
  55. .. rst-class:: classref-reftable-group
  56. Methods
  57. -------
  58. .. table::
  59. :widths: auto
  60. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`_enter_tree<class_Node_method__enter_tree>` **(** **)** |virtual| |
  62. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`_exit_tree<class_Node_method__exit_tree>` **(** **)** |virtual| |
  64. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`String<class_String>` | :ref:`_get_configuration_warning<class_Node_method__get_configuration_warning>` **(** **)** |virtual| |
  66. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`_input<class_Node_method__input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  68. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`_physics_process<class_Node_method__physics_process>` **(** :ref:`float<class_float>` delta **)** |virtual| |
  70. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`_process<class_Node_method__process>` **(** :ref:`float<class_float>` delta **)** |virtual| |
  72. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`_ready<class_Node_method__ready>` **(** **)** |virtual| |
  74. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`_unhandled_input<class_Node_method__unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  76. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`_unhandled_key_input<class_Node_method__unhandled_key_input>` **(** :ref:`InputEventKey<class_InputEventKey>` event **)** |virtual| |
  78. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`add_child<class_Node_method_add_child>` **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` force_readable_name=false **)** |
  80. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`add_child_below_node<class_Node_method_add_child_below_node>` **(** :ref:`Node<class_Node>` node, :ref:`Node<class_Node>` child_node, :ref:`bool<class_bool>` force_readable_name=false **)** |
  82. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`add_to_group<class_Node_method_add_to_group>` **(** :ref:`String<class_String>` group, :ref:`bool<class_bool>` persistent=false **)** |
  84. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`bool<class_bool>` | :ref:`can_process<class_Node_method_can_process>` **(** **)** |const| |
  86. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`SceneTreeTween<class_SceneTreeTween>` | :ref:`create_tween<class_Node_method_create_tween>` **(** **)** |
  88. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Node<class_Node>` | :ref:`duplicate<class_Node_method_duplicate>` **(** :ref:`int<class_int>` flags=15 **)** |const| |
  90. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Node<class_Node>` | :ref:`find_node<class_Node_method_find_node>` **(** :ref:`String<class_String>` mask, :ref:`bool<class_bool>` recursive=true, :ref:`bool<class_bool>` owned=true **)** |const| |
  92. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Node<class_Node>` | :ref:`find_parent<class_Node_method_find_parent>` **(** :ref:`String<class_String>` mask **)** |const| |
  94. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`Node<class_Node>` | :ref:`get_child<class_Node_method_get_child>` **(** :ref:`int<class_int>` idx **)** |const| |
  96. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`int<class_int>` | :ref:`get_child_count<class_Node_method_get_child_count>` **(** **)** |const| |
  98. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Array<class_Array>` | :ref:`get_children<class_Node_method_get_children>` **(** **)** |const| |
  100. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Array<class_Array>` | :ref:`get_groups<class_Node_method_get_groups>` **(** **)** |const| |
  102. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`int<class_int>` | :ref:`get_index<class_Node_method_get_index>` **(** **)** |const| |
  104. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`int<class_int>` | :ref:`get_network_master<class_Node_method_get_network_master>` **(** **)** |const| |
  106. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`Node<class_Node>` | :ref:`get_node<class_Node_method_get_node>` **(** :ref:`NodePath<class_NodePath>` path **)** |const| |
  108. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`Array<class_Array>` | :ref:`get_node_and_resource<class_Node_method_get_node_and_resource>` **(** :ref:`NodePath<class_NodePath>` path **)** |
  110. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`Node<class_Node>` | :ref:`get_node_or_null<class_Node_method_get_node_or_null>` **(** :ref:`NodePath<class_NodePath>` path **)** |const| |
  112. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`Node<class_Node>` | :ref:`get_parent<class_Node_method_get_parent>` **(** **)** |const| |
  114. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`NodePath<class_NodePath>` | :ref:`get_path<class_Node_method_get_path>` **(** **)** |const| |
  116. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`NodePath<class_NodePath>` | :ref:`get_path_to<class_Node_method_get_path_to>` **(** :ref:`Node<class_Node>` node **)** |const| |
  118. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`float<class_float>` | :ref:`get_physics_process_delta_time<class_Node_method_get_physics_process_delta_time>` **(** **)** |const| |
  120. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`int<class_int>` | :ref:`get_position_in_parent<class_Node_method_get_position_in_parent>` **(** **)** |const| |
  122. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`float<class_float>` | :ref:`get_process_delta_time<class_Node_method_get_process_delta_time>` **(** **)** |const| |
  124. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`bool<class_bool>` | :ref:`get_scene_instance_load_placeholder<class_Node_method_get_scene_instance_load_placeholder>` **(** **)** |const| |
  126. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`SceneTree<class_SceneTree>` | :ref:`get_tree<class_Node_method_get_tree>` **(** **)** |const| |
  128. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`Viewport<class_Viewport>` | :ref:`get_viewport<class_Node_method_get_viewport>` **(** **)** |const| |
  130. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`bool<class_bool>` | :ref:`has_node<class_Node_method_has_node>` **(** :ref:`NodePath<class_NodePath>` path **)** |const| |
  132. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`bool<class_bool>` | :ref:`has_node_and_resource<class_Node_method_has_node_and_resource>` **(** :ref:`NodePath<class_NodePath>` path **)** |const| |
  134. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`bool<class_bool>` | :ref:`is_a_parent_of<class_Node_method_is_a_parent_of>` **(** :ref:`Node<class_Node>` node **)** |const| |
  136. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`bool<class_bool>` | :ref:`is_displayed_folded<class_Node_method_is_displayed_folded>` **(** **)** |const| |
  138. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`bool<class_bool>` | :ref:`is_editable_instance<class_Node_method_is_editable_instance>` **(** :ref:`Node<class_Node>` node **)** |const| |
  140. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`bool<class_bool>` | :ref:`is_greater_than<class_Node_method_is_greater_than>` **(** :ref:`Node<class_Node>` node **)** |const| |
  142. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | :ref:`bool<class_bool>` | :ref:`is_in_group<class_Node_method_is_in_group>` **(** :ref:`String<class_String>` group **)** |const| |
  144. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | :ref:`bool<class_bool>` | :ref:`is_inside_tree<class_Node_method_is_inside_tree>` **(** **)** |const| |
  146. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`bool<class_bool>` | :ref:`is_network_master<class_Node_method_is_network_master>` **(** **)** |const| |
  148. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | :ref:`bool<class_bool>` | :ref:`is_node_ready<class_Node_method_is_node_ready>` **(** **)** |const| |
  150. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | :ref:`bool<class_bool>` | :ref:`is_physics_interpolated<class_Node_method_is_physics_interpolated>` **(** **)** |const| |
  152. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`bool<class_bool>` | :ref:`is_physics_interpolated_and_enabled<class_Node_method_is_physics_interpolated_and_enabled>` **(** **)** |const| |
  154. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :ref:`bool<class_bool>` | :ref:`is_physics_processing<class_Node_method_is_physics_processing>` **(** **)** |const| |
  156. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :ref:`bool<class_bool>` | :ref:`is_physics_processing_internal<class_Node_method_is_physics_processing_internal>` **(** **)** |const| |
  158. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`bool<class_bool>` | :ref:`is_processing<class_Node_method_is_processing>` **(** **)** |const| |
  160. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | :ref:`bool<class_bool>` | :ref:`is_processing_input<class_Node_method_is_processing_input>` **(** **)** |const| |
  162. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | :ref:`bool<class_bool>` | :ref:`is_processing_internal<class_Node_method_is_processing_internal>` **(** **)** |const| |
  164. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | :ref:`bool<class_bool>` | :ref:`is_processing_unhandled_input<class_Node_method_is_processing_unhandled_input>` **(** **)** |const| |
  166. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | :ref:`bool<class_bool>` | :ref:`is_processing_unhandled_key_input<class_Node_method_is_processing_unhandled_key_input>` **(** **)** |const| |
  168. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`move_child<class_Node_method_move_child>` **(** :ref:`Node<class_Node>` child_node, :ref:`int<class_int>` to_position **)** |
  170. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`print_stray_nodes<class_Node_method_print_stray_nodes>` **(** **)** |
  172. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | void | :ref:`print_tree<class_Node_method_print_tree>` **(** **)** |
  174. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | void | :ref:`print_tree_pretty<class_Node_method_print_tree_pretty>` **(** **)** |
  176. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | void | :ref:`propagate_call<class_Node_method_propagate_call>` **(** :ref:`String<class_String>` method, :ref:`Array<class_Array>` args=[ ], :ref:`bool<class_bool>` parent_first=false **)** |
  178. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | void | :ref:`propagate_notification<class_Node_method_propagate_notification>` **(** :ref:`int<class_int>` what **)** |
  180. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | void | :ref:`queue_free<class_Node_method_queue_free>` **(** **)** |
  182. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | void | :ref:`raise<class_Node_method_raise>` **(** **)** |
  184. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | void | :ref:`remove_and_skip<class_Node_method_remove_and_skip>` **(** **)** |
  186. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | void | :ref:`remove_child<class_Node_method_remove_child>` **(** :ref:`Node<class_Node>` node **)** |
  188. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | void | :ref:`remove_from_group<class_Node_method_remove_from_group>` **(** :ref:`String<class_String>` group **)** |
  190. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | void | :ref:`replace_by<class_Node_method_replace_by>` **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` keep_data=false **)** |
  192. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. | void | :ref:`request_ready<class_Node_method_request_ready>` **(** **)** |
  194. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  195. | void | :ref:`reset_physics_interpolation<class_Node_method_reset_physics_interpolation>` **(** **)** |
  196. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  197. | :ref:`Variant<class_Variant>` | :ref:`rpc<class_Node_method_rpc>` **(** :ref:`String<class_String>` method, ... **)** |vararg| |
  198. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  199. | void | :ref:`rpc_config<class_Node_method_rpc_config>` **(** :ref:`String<class_String>` method, :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>` mode **)** |
  200. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  201. | :ref:`Variant<class_Variant>` | :ref:`rpc_id<class_Node_method_rpc_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` method, ... **)** |vararg| |
  202. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  203. | :ref:`Variant<class_Variant>` | :ref:`rpc_unreliable<class_Node_method_rpc_unreliable>` **(** :ref:`String<class_String>` method, ... **)** |vararg| |
  204. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  205. | :ref:`Variant<class_Variant>` | :ref:`rpc_unreliable_id<class_Node_method_rpc_unreliable_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` method, ... **)** |vararg| |
  206. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  207. | void | :ref:`rset<class_Node_method_rset>` **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |
  208. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  209. | void | :ref:`rset_config<class_Node_method_rset_config>` **(** :ref:`String<class_String>` property, :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>` mode **)** |
  210. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  211. | void | :ref:`rset_id<class_Node_method_rset_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |
  212. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  213. | void | :ref:`rset_unreliable<class_Node_method_rset_unreliable>` **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |
  214. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  215. | void | :ref:`rset_unreliable_id<class_Node_method_rset_unreliable_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)** |
  216. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  217. | void | :ref:`set_display_folded<class_Node_method_set_display_folded>` **(** :ref:`bool<class_bool>` fold **)** |
  218. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  219. | void | :ref:`set_editable_instance<class_Node_method_set_editable_instance>` **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` is_editable **)** |
  220. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  221. | void | :ref:`set_network_master<class_Node_method_set_network_master>` **(** :ref:`int<class_int>` id, :ref:`bool<class_bool>` recursive=true **)** |
  222. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  223. | void | :ref:`set_physics_process<class_Node_method_set_physics_process>` **(** :ref:`bool<class_bool>` enable **)** |
  224. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  225. | void | :ref:`set_physics_process_internal<class_Node_method_set_physics_process_internal>` **(** :ref:`bool<class_bool>` enable **)** |
  226. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  227. | void | :ref:`set_process<class_Node_method_set_process>` **(** :ref:`bool<class_bool>` enable **)** |
  228. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  229. | void | :ref:`set_process_input<class_Node_method_set_process_input>` **(** :ref:`bool<class_bool>` enable **)** |
  230. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  231. | void | :ref:`set_process_internal<class_Node_method_set_process_internal>` **(** :ref:`bool<class_bool>` enable **)** |
  232. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  233. | void | :ref:`set_process_unhandled_input<class_Node_method_set_process_unhandled_input>` **(** :ref:`bool<class_bool>` enable **)** |
  234. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  235. | void | :ref:`set_process_unhandled_key_input<class_Node_method_set_process_unhandled_key_input>` **(** :ref:`bool<class_bool>` enable **)** |
  236. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  237. | void | :ref:`set_scene_instance_load_placeholder<class_Node_method_set_scene_instance_load_placeholder>` **(** :ref:`bool<class_bool>` load_placeholder **)** |
  238. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  239. | void | :ref:`update_configuration_warning<class_Node_method_update_configuration_warning>` **(** **)** |
  240. +---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  241. .. rst-class:: classref-section-separator
  242. ----
  243. .. rst-class:: classref-descriptions-group
  244. Signals
  245. -------
  246. .. _class_Node_signal_child_entered_tree:
  247. .. rst-class:: classref-signal
  248. **child_entered_tree** **(** :ref:`Node<class_Node>` node **)**
  249. Emitted when a child node enters the scene tree, either because it entered on its own or because this node entered with it.
  250. This signal is emitted *after* the child node's own :ref:`NOTIFICATION_ENTER_TREE<class_Node_constant_NOTIFICATION_ENTER_TREE>` and :ref:`tree_entered<class_Node_signal_tree_entered>`.
  251. .. rst-class:: classref-item-separator
  252. ----
  253. .. _class_Node_signal_child_exiting_tree:
  254. .. rst-class:: classref-signal
  255. **child_exiting_tree** **(** :ref:`Node<class_Node>` node **)**
  256. Emitted when a child node is about to exit the scene tree, either because it is being removed or freed directly, or because this node is exiting the tree.
  257. When this signal is received, the child ``node`` is still in the tree and valid. This signal is emitted *after* the child node's own :ref:`tree_exiting<class_Node_signal_tree_exiting>` and :ref:`NOTIFICATION_EXIT_TREE<class_Node_constant_NOTIFICATION_EXIT_TREE>`.
  258. .. rst-class:: classref-item-separator
  259. ----
  260. .. _class_Node_signal_child_order_changed:
  261. .. rst-class:: classref-signal
  262. **child_order_changed** **(** **)**
  263. Emitted when the list of children is changed. This happens when child nodes are added, moved, or removed.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_Node_signal_ready:
  267. .. rst-class:: classref-signal
  268. **ready** **(** **)**
  269. Emitted when the node is ready.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_Node_signal_renamed:
  273. .. rst-class:: classref-signal
  274. **renamed** **(** **)**
  275. Emitted when the node is renamed.
  276. .. rst-class:: classref-item-separator
  277. ----
  278. .. _class_Node_signal_tree_entered:
  279. .. rst-class:: classref-signal
  280. **tree_entered** **(** **)**
  281. Emitted when the node enters the tree.
  282. This signal is emitted *after* the related :ref:`NOTIFICATION_ENTER_TREE<class_Node_constant_NOTIFICATION_ENTER_TREE>` notification.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_Node_signal_tree_exited:
  286. .. rst-class:: classref-signal
  287. **tree_exited** **(** **)**
  288. Emitted after the node exits the tree and is no longer active.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_Node_signal_tree_exiting:
  292. .. rst-class:: classref-signal
  293. **tree_exiting** **(** **)**
  294. Emitted when the node is still active but about to exit the tree. This is the right place for de-initialization (or a "destructor", if you will).
  295. This signal is emitted *before* the related :ref:`NOTIFICATION_EXIT_TREE<class_Node_constant_NOTIFICATION_EXIT_TREE>` notification.
  296. .. rst-class:: classref-section-separator
  297. ----
  298. .. rst-class:: classref-descriptions-group
  299. Enumerations
  300. ------------
  301. .. _enum_Node_PauseMode:
  302. .. rst-class:: classref-enumeration
  303. enum **PauseMode**:
  304. .. _class_Node_constant_PAUSE_MODE_INHERIT:
  305. .. rst-class:: classref-enumeration-constant
  306. :ref:`PauseMode<enum_Node_PauseMode>` **PAUSE_MODE_INHERIT** = ``0``
  307. Inherits pause mode from the node's parent. For the root node, it is equivalent to :ref:`PAUSE_MODE_STOP<class_Node_constant_PAUSE_MODE_STOP>`. Default.
  308. .. _class_Node_constant_PAUSE_MODE_STOP:
  309. .. rst-class:: classref-enumeration-constant
  310. :ref:`PauseMode<enum_Node_PauseMode>` **PAUSE_MODE_STOP** = ``1``
  311. Stops processing when the :ref:`SceneTree<class_SceneTree>` is paused.
  312. .. _class_Node_constant_PAUSE_MODE_PROCESS:
  313. .. rst-class:: classref-enumeration-constant
  314. :ref:`PauseMode<enum_Node_PauseMode>` **PAUSE_MODE_PROCESS** = ``2``
  315. Continue to process regardless of the :ref:`SceneTree<class_SceneTree>` pause state.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _enum_Node_PhysicsInterpolationMode:
  319. .. rst-class:: classref-enumeration
  320. enum **PhysicsInterpolationMode**:
  321. .. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT:
  322. .. rst-class:: classref-enumeration-constant
  323. :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_INHERIT** = ``0``
  324. Inherits physics interpolation mode from the node's parent. For the root node, it is equivalent to :ref:`PHYSICS_INTERPOLATION_MODE_ON<class_Node_constant_PHYSICS_INTERPOLATION_MODE_ON>`. Default.
  325. .. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_OFF:
  326. .. rst-class:: classref-enumeration-constant
  327. :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_OFF** = ``1``
  328. Turn off physics interpolation in this node and children set to :ref:`PHYSICS_INTERPOLATION_MODE_INHERIT<class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT>`.
  329. .. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_ON:
  330. .. rst-class:: classref-enumeration-constant
  331. :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_ON** = ``2``
  332. Turn on physics interpolation in this node and children set to :ref:`PHYSICS_INTERPOLATION_MODE_INHERIT<class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT>`.
  333. .. rst-class:: classref-item-separator
  334. ----
  335. .. _enum_Node_DuplicateFlags:
  336. .. rst-class:: classref-enumeration
  337. enum **DuplicateFlags**:
  338. .. _class_Node_constant_DUPLICATE_SIGNALS:
  339. .. rst-class:: classref-enumeration-constant
  340. :ref:`DuplicateFlags<enum_Node_DuplicateFlags>` **DUPLICATE_SIGNALS** = ``1``
  341. Duplicate the node's signals.
  342. .. _class_Node_constant_DUPLICATE_GROUPS:
  343. .. rst-class:: classref-enumeration-constant
  344. :ref:`DuplicateFlags<enum_Node_DuplicateFlags>` **DUPLICATE_GROUPS** = ``2``
  345. Duplicate the node's groups.
  346. .. _class_Node_constant_DUPLICATE_SCRIPTS:
  347. .. rst-class:: classref-enumeration-constant
  348. :ref:`DuplicateFlags<enum_Node_DuplicateFlags>` **DUPLICATE_SCRIPTS** = ``4``
  349. Duplicate the node's scripts.
  350. .. _class_Node_constant_DUPLICATE_USE_INSTANCING:
  351. .. rst-class:: classref-enumeration-constant
  352. :ref:`DuplicateFlags<enum_Node_DuplicateFlags>` **DUPLICATE_USE_INSTANCING** = ``8``
  353. Duplicate using instancing.
  354. An instance stays linked to the original so when the original changes, the instance changes too.
  355. .. rst-class:: classref-section-separator
  356. ----
  357. .. rst-class:: classref-descriptions-group
  358. Constants
  359. ---------
  360. .. _class_Node_constant_NOTIFICATION_ENTER_TREE:
  361. .. rst-class:: classref-constant
  362. **NOTIFICATION_ENTER_TREE** = ``10``
  363. Notification received when the node enters a :ref:`SceneTree<class_SceneTree>`.
  364. This notification is emitted *before* the related :ref:`tree_entered<class_Node_signal_tree_entered>`.
  365. .. _class_Node_constant_NOTIFICATION_EXIT_TREE:
  366. .. rst-class:: classref-constant
  367. **NOTIFICATION_EXIT_TREE** = ``11``
  368. Notification received when the node is about to exit a :ref:`SceneTree<class_SceneTree>`.
  369. This notification is emitted *after* the related :ref:`tree_exiting<class_Node_signal_tree_exiting>`.
  370. .. _class_Node_constant_NOTIFICATION_MOVED_IN_PARENT:
  371. .. rst-class:: classref-constant
  372. **NOTIFICATION_MOVED_IN_PARENT** = ``12``
  373. *Deprecated.* This notification is no longer emitted. Use :ref:`NOTIFICATION_CHILD_ORDER_CHANGED<class_Node_constant_NOTIFICATION_CHILD_ORDER_CHANGED>` instead.
  374. .. _class_Node_constant_NOTIFICATION_READY:
  375. .. rst-class:: classref-constant
  376. **NOTIFICATION_READY** = ``13``
  377. Notification received when the node is ready. See :ref:`_ready<class_Node_method__ready>`.
  378. .. _class_Node_constant_NOTIFICATION_PAUSED:
  379. .. rst-class:: classref-constant
  380. **NOTIFICATION_PAUSED** = ``14``
  381. Notification received when the node is paused.
  382. .. _class_Node_constant_NOTIFICATION_UNPAUSED:
  383. .. rst-class:: classref-constant
  384. **NOTIFICATION_UNPAUSED** = ``15``
  385. Notification received when the node is unpaused.
  386. .. _class_Node_constant_NOTIFICATION_PHYSICS_PROCESS:
  387. .. rst-class:: classref-constant
  388. **NOTIFICATION_PHYSICS_PROCESS** = ``16``
  389. Notification received every frame when the physics process flag is set (see :ref:`set_physics_process<class_Node_method_set_physics_process>`).
  390. .. _class_Node_constant_NOTIFICATION_PROCESS:
  391. .. rst-class:: classref-constant
  392. **NOTIFICATION_PROCESS** = ``17``
  393. Notification received every frame when the process flag is set (see :ref:`set_process<class_Node_method_set_process>`).
  394. .. _class_Node_constant_NOTIFICATION_PARENTED:
  395. .. rst-class:: classref-constant
  396. **NOTIFICATION_PARENTED** = ``18``
  397. Notification received when a node is set as a child of another node.
  398. \ **Note:** This doesn't mean that a node entered the :ref:`SceneTree<class_SceneTree>`.
  399. .. _class_Node_constant_NOTIFICATION_UNPARENTED:
  400. .. rst-class:: classref-constant
  401. **NOTIFICATION_UNPARENTED** = ``19``
  402. Notification received when a node is unparented (parent removed it from the list of children).
  403. .. _class_Node_constant_NOTIFICATION_INSTANCED:
  404. .. rst-class:: classref-constant
  405. **NOTIFICATION_INSTANCED** = ``20``
  406. Notification received when the node is instanced.
  407. .. _class_Node_constant_NOTIFICATION_DRAG_BEGIN:
  408. .. rst-class:: classref-constant
  409. **NOTIFICATION_DRAG_BEGIN** = ``21``
  410. Notification received when a drag operation begins. All nodes receive this notification, not only the dragged one.
  411. Can be triggered either by dragging a :ref:`Control<class_Control>` that provides drag data (see :ref:`Control.get_drag_data<class_Control_method_get_drag_data>`) or using :ref:`Control.force_drag<class_Control_method_force_drag>`.
  412. Use :ref:`Viewport.gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` to get the dragged data.
  413. .. _class_Node_constant_NOTIFICATION_DRAG_END:
  414. .. rst-class:: classref-constant
  415. **NOTIFICATION_DRAG_END** = ``22``
  416. Notification received when a drag operation ends.
  417. Use :ref:`Viewport.gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>` to check if the drag succeeded.
  418. .. _class_Node_constant_NOTIFICATION_PATH_CHANGED:
  419. .. rst-class:: classref-constant
  420. **NOTIFICATION_PATH_CHANGED** = ``23``
  421. Notification received when the node's :ref:`NodePath<class_NodePath>` changed.
  422. .. _class_Node_constant_NOTIFICATION_CHILD_ORDER_CHANGED:
  423. .. rst-class:: classref-constant
  424. **NOTIFICATION_CHILD_ORDER_CHANGED** = ``24``
  425. Notification received when the list of children is changed. This happens when child nodes are added, moved, or removed.
  426. .. _class_Node_constant_NOTIFICATION_INTERNAL_PROCESS:
  427. .. rst-class:: classref-constant
  428. **NOTIFICATION_INTERNAL_PROCESS** = ``25``
  429. Notification received every frame when the internal process flag is set (see :ref:`set_process_internal<class_Node_method_set_process_internal>`).
  430. .. _class_Node_constant_NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
  431. .. rst-class:: classref-constant
  432. **NOTIFICATION_INTERNAL_PHYSICS_PROCESS** = ``26``
  433. Notification received every frame when the internal physics process flag is set (see :ref:`set_physics_process_internal<class_Node_method_set_physics_process_internal>`).
  434. .. _class_Node_constant_NOTIFICATION_POST_ENTER_TREE:
  435. .. rst-class:: classref-constant
  436. **NOTIFICATION_POST_ENTER_TREE** = ``27``
  437. Notification received when the node is ready, just before :ref:`NOTIFICATION_READY<class_Node_constant_NOTIFICATION_READY>` is received. Unlike the latter, it's sent every time the node enters tree, instead of only once.
  438. .. _class_Node_constant_NOTIFICATION_RESET_PHYSICS_INTERPOLATION:
  439. .. rst-class:: classref-constant
  440. **NOTIFICATION_RESET_PHYSICS_INTERPOLATION** = ``28``
  441. Notification received when :ref:`reset_physics_interpolation<class_Node_method_reset_physics_interpolation>` is called on the node or parent nodes.
  442. .. _class_Node_constant_NOTIFICATION_WM_MOUSE_ENTER:
  443. .. rst-class:: classref-constant
  444. **NOTIFICATION_WM_MOUSE_ENTER** = ``1002``
  445. Notification received from the OS when the mouse enters the game window.
  446. Implemented on desktop and web platforms.
  447. .. _class_Node_constant_NOTIFICATION_WM_MOUSE_EXIT:
  448. .. rst-class:: classref-constant
  449. **NOTIFICATION_WM_MOUSE_EXIT** = ``1003``
  450. Notification received from the OS when the mouse leaves the game window.
  451. Implemented on desktop and web platforms.
  452. .. _class_Node_constant_NOTIFICATION_WM_FOCUS_IN:
  453. .. rst-class:: classref-constant
  454. **NOTIFICATION_WM_FOCUS_IN** = ``1004``
  455. Notification received from the OS when the game window is focused.
  456. Implemented on all platforms.
  457. .. _class_Node_constant_NOTIFICATION_WM_FOCUS_OUT:
  458. .. rst-class:: classref-constant
  459. **NOTIFICATION_WM_FOCUS_OUT** = ``1005``
  460. Notification received from the OS when the game window is unfocused.
  461. Implemented on all platforms.
  462. .. _class_Node_constant_NOTIFICATION_WM_QUIT_REQUEST:
  463. .. rst-class:: classref-constant
  464. **NOTIFICATION_WM_QUIT_REQUEST** = ``1006``
  465. Notification received from the OS when a quit request is sent (e.g. closing the window with a "Close" button or :kbd:`Alt + F4`).
  466. Implemented on desktop platforms.
  467. .. _class_Node_constant_NOTIFICATION_WM_GO_BACK_REQUEST:
  468. .. rst-class:: classref-constant
  469. **NOTIFICATION_WM_GO_BACK_REQUEST** = ``1007``
  470. Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
  471. Specific to the Android platform.
  472. .. _class_Node_constant_NOTIFICATION_WM_UNFOCUS_REQUEST:
  473. .. rst-class:: classref-constant
  474. **NOTIFICATION_WM_UNFOCUS_REQUEST** = ``1008``
  475. Notification received from the OS when an unfocus request is sent (e.g. another OS window wants to take the focus).
  476. No supported platforms currently send this notification.
  477. .. _class_Node_constant_NOTIFICATION_OS_MEMORY_WARNING:
  478. .. rst-class:: classref-constant
  479. **NOTIFICATION_OS_MEMORY_WARNING** = ``1009``
  480. Notification received from the OS when the application is exceeding its allocated memory.
  481. Specific to the iOS platform.
  482. .. _class_Node_constant_NOTIFICATION_TRANSLATION_CHANGED:
  483. .. rst-class:: classref-constant
  484. **NOTIFICATION_TRANSLATION_CHANGED** = ``1010``
  485. Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like :ref:`Object.tr<class_Object_method_tr>`.
  486. .. _class_Node_constant_NOTIFICATION_WM_ABOUT:
  487. .. rst-class:: classref-constant
  488. **NOTIFICATION_WM_ABOUT** = ``1011``
  489. Notification received from the OS when a request for "About" information is sent.
  490. Specific to the macOS platform.
  491. .. _class_Node_constant_NOTIFICATION_CRASH:
  492. .. rst-class:: classref-constant
  493. **NOTIFICATION_CRASH** = ``1012``
  494. Notification received from Godot's crash handler when the engine is about to crash.
  495. Implemented on desktop platforms if the crash handler is enabled.
  496. .. _class_Node_constant_NOTIFICATION_OS_IME_UPDATE:
  497. .. rst-class:: classref-constant
  498. **NOTIFICATION_OS_IME_UPDATE** = ``1013``
  499. Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string).
  500. Specific to the macOS platform.
  501. .. _class_Node_constant_NOTIFICATION_APP_RESUMED:
  502. .. rst-class:: classref-constant
  503. **NOTIFICATION_APP_RESUMED** = ``1014``
  504. Notification received from the OS when the app is resumed.
  505. Specific to mobile platforms.
  506. .. _class_Node_constant_NOTIFICATION_APP_PAUSED:
  507. .. rst-class:: classref-constant
  508. **NOTIFICATION_APP_PAUSED** = ``1015``
  509. Notification received from the OS when the app is paused.
  510. Specific to mobile platforms.
  511. \ **Note:** On iOS, you only have approximately 5 seconds to finish a task started by this signal. If you go over this allotment, iOS will kill the app instead of pausing it.
  512. .. rst-class:: classref-section-separator
  513. ----
  514. .. rst-class:: classref-descriptions-group
  515. Property Descriptions
  516. ---------------------
  517. .. _class_Node_property_custom_multiplayer:
  518. .. rst-class:: classref-property
  519. :ref:`MultiplayerAPI<class_MultiplayerAPI>` **custom_multiplayer**
  520. .. rst-class:: classref-property-setget
  521. - void **set_custom_multiplayer** **(** :ref:`MultiplayerAPI<class_MultiplayerAPI>` value **)**
  522. - :ref:`MultiplayerAPI<class_MultiplayerAPI>` **get_custom_multiplayer** **(** **)**
  523. The override to the default :ref:`MultiplayerAPI<class_MultiplayerAPI>`. Set to ``null`` to use the default :ref:`SceneTree<class_SceneTree>` one.
  524. .. rst-class:: classref-item-separator
  525. ----
  526. .. _class_Node_property_filename:
  527. .. rst-class:: classref-property
  528. :ref:`String<class_String>` **filename**
  529. .. rst-class:: classref-property-setget
  530. - void **set_filename** **(** :ref:`String<class_String>` value **)**
  531. - :ref:`String<class_String>` **get_filename** **(** **)**
  532. If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in :ref:`filename<class_Node_property_filename>` (e.g. ``res://levels/1.tscn``). Otherwise, :ref:`filename<class_Node_property_filename>` is set to an empty string.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_Node_property_multiplayer:
  536. .. rst-class:: classref-property
  537. :ref:`MultiplayerAPI<class_MultiplayerAPI>` **multiplayer**
  538. .. rst-class:: classref-property-setget
  539. - :ref:`MultiplayerAPI<class_MultiplayerAPI>` **get_multiplayer** **(** **)**
  540. The :ref:`MultiplayerAPI<class_MultiplayerAPI>` instance associated with this node. Either the :ref:`custom_multiplayer<class_Node_property_custom_multiplayer>`, or the default SceneTree one (if inside tree).
  541. .. rst-class:: classref-item-separator
  542. ----
  543. .. _class_Node_property_name:
  544. .. rst-class:: classref-property
  545. :ref:`String<class_String>` **name**
  546. .. rst-class:: classref-property-setget
  547. - void **set_name** **(** :ref:`String<class_String>` value **)**
  548. - :ref:`String<class_String>` **get_name** **(** **)**
  549. The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed.
  550. \ **Note:** Auto-generated names might include the ``@`` character, which is reserved for unique names when using :ref:`add_child<class_Node_method_add_child>`. When setting the name manually, any ``@`` will be removed.
  551. .. rst-class:: classref-item-separator
  552. ----
  553. .. _class_Node_property_owner:
  554. .. rst-class:: classref-property
  555. :ref:`Node<class_Node>` **owner**
  556. .. rst-class:: classref-property-setget
  557. - void **set_owner** **(** :ref:`Node<class_Node>` value **)**
  558. - :ref:`Node<class_Node>` **get_owner** **(** **)**
  559. The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using :ref:`PackedScene<class_PackedScene>`), all the nodes it owns will be saved with it. This allows for the creation of complex :ref:`SceneTree<class_SceneTree>`\ s, with instancing and subinstancing.
  560. \ **Note:** If you want a child to be persisted to a :ref:`PackedScene<class_PackedScene>`, you must set :ref:`owner<class_Node_property_owner>` in addition to calling :ref:`add_child<class_Node_method_add_child>`. This is typically relevant for :doc:`tool scripts <../tutorials/plugins/running_code_in_the_editor>` and :doc:`editor plugins <../tutorials/plugins/editor/index>`. If :ref:`add_child<class_Node_method_add_child>` is called without setting :ref:`owner<class_Node_property_owner>`, the newly added **Node** will not be visible in the scene tree, though it will be visible in the 2D/3D view.
  561. .. rst-class:: classref-item-separator
  562. ----
  563. .. _class_Node_property_pause_mode:
  564. .. rst-class:: classref-property
  565. :ref:`PauseMode<enum_Node_PauseMode>` **pause_mode** = ``0``
  566. .. rst-class:: classref-property-setget
  567. - void **set_pause_mode** **(** :ref:`PauseMode<enum_Node_PauseMode>` value **)**
  568. - :ref:`PauseMode<enum_Node_PauseMode>` **get_pause_mode** **(** **)**
  569. Pause mode. How the node will behave if the :ref:`SceneTree<class_SceneTree>` is paused.
  570. .. rst-class:: classref-item-separator
  571. ----
  572. .. _class_Node_property_physics_interpolation_mode:
  573. .. rst-class:: classref-property
  574. :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **physics_interpolation_mode** = ``0``
  575. .. rst-class:: classref-property-setget
  576. - void **set_physics_interpolation_mode** **(** :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` value **)**
  577. - :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **get_physics_interpolation_mode** **(** **)**
  578. Allows enabling or disabling physics interpolation per node, offering a finer grain of control than turning physics interpolation on and off globally.
  579. \ **Note:** This can be especially useful for :ref:`Camera<class_Camera>`\ s, where custom interpolation can sometimes give superior results.
  580. .. rst-class:: classref-item-separator
  581. ----
  582. .. _class_Node_property_process_priority:
  583. .. rst-class:: classref-property
  584. :ref:`int<class_int>` **process_priority** = ``0``
  585. .. rst-class:: classref-property-setget
  586. - void **set_process_priority** **(** :ref:`int<class_int>` value **)**
  587. - :ref:`int<class_int>` **get_process_priority** **(** **)**
  588. The node's priority in the execution order of the enabled processing callbacks (i.e. :ref:`NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>`, :ref:`NOTIFICATION_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_PHYSICS_PROCESS>` and their internal counterparts). Nodes whose process priority value is *lower* will have their processing callbacks executed first.
  589. .. rst-class:: classref-item-separator
  590. ----
  591. .. _class_Node_property_unique_name_in_owner:
  592. .. rst-class:: classref-property
  593. :ref:`bool<class_bool>` **unique_name_in_owner** = ``false``
  594. .. rst-class:: classref-property-setget
  595. - void **set_unique_name_in_owner** **(** :ref:`bool<class_bool>` value **)**
  596. - :ref:`bool<class_bool>` **is_unique_name_in_owner** **(** **)**
  597. Sets this node's name as a unique name in its :ref:`owner<class_Node_property_owner>`. This allows the node to be accessed as ``%Name`` instead of the full path, from any node within that scene.
  598. If another node with the same owner already had that name declared as unique, that other node's name will no longer be set as having a unique name.
  599. .. rst-class:: classref-section-separator
  600. ----
  601. .. rst-class:: classref-descriptions-group
  602. Method Descriptions
  603. -------------------
  604. .. _class_Node_method__enter_tree:
  605. .. rst-class:: classref-method
  606. void **_enter_tree** **(** **)** |virtual|
  607. Called when the node enters the :ref:`SceneTree<class_SceneTree>` (e.g. upon instancing, scene changing, or after calling :ref:`add_child<class_Node_method_add_child>` in a script). If the node has children, its :ref:`_enter_tree<class_Node_method__enter_tree>` callback will be called first, and then that of the children.
  608. Corresponds to the :ref:`NOTIFICATION_ENTER_TREE<class_Node_constant_NOTIFICATION_ENTER_TREE>` notification in :ref:`Object._notification<class_Object_method__notification>`.
  609. .. rst-class:: classref-item-separator
  610. ----
  611. .. _class_Node_method__exit_tree:
  612. .. rst-class:: classref-method
  613. void **_exit_tree** **(** **)** |virtual|
  614. Called when the node is about to leave the :ref:`SceneTree<class_SceneTree>` (e.g. upon freeing, scene changing, or after calling :ref:`remove_child<class_Node_method_remove_child>` in a script). If the node has children, its :ref:`_exit_tree<class_Node_method__exit_tree>` callback will be called last, after all its children have left the tree.
  615. Corresponds to the :ref:`NOTIFICATION_EXIT_TREE<class_Node_constant_NOTIFICATION_EXIT_TREE>` notification in :ref:`Object._notification<class_Object_method__notification>` and signal :ref:`tree_exiting<class_Node_signal_tree_exiting>`. To get notified when the node has already left the active tree, connect to the :ref:`tree_exited<class_Node_signal_tree_exited>`.
  616. .. rst-class:: classref-item-separator
  617. ----
  618. .. _class_Node_method__get_configuration_warning:
  619. .. rst-class:: classref-method
  620. :ref:`String<class_String>` **_get_configuration_warning** **(** **)** |virtual|
  621. The string returned from this method is displayed as a warning in the Scene Dock if the script that overrides it is a ``tool`` script.
  622. Returning an empty string produces no warning.
  623. Call :ref:`update_configuration_warning<class_Node_method_update_configuration_warning>` when the warning needs to be updated for this node.
  624. .. rst-class:: classref-item-separator
  625. ----
  626. .. _class_Node_method__input:
  627. .. rst-class:: classref-method
  628. void **_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  629. Called when there is an input event. The input event propagates up through the node tree until a node consumes it.
  630. It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_process_input<class_Node_method_set_process_input>`.
  631. To consume the input event and stop it propagating further to other nodes, :ref:`SceneTree.set_input_as_handled<class_SceneTree_method_set_input_as_handled>` can be called.
  632. For gameplay input, :ref:`_unhandled_input<class_Node_method__unhandled_input>` and :ref:`_unhandled_key_input<class_Node_method__unhandled_key_input>` are usually a better fit as they allow the GUI to intercept the events first.
  633. \ **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
  634. .. rst-class:: classref-item-separator
  635. ----
  636. .. _class_Node_method__physics_process:
  637. .. rst-class:: classref-method
  638. void **_physics_process** **(** :ref:`float<class_float>` delta **)** |virtual|
  639. Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the ``delta`` variable should be constant. ``delta`` is in seconds.
  640. It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_physics_process<class_Node_method_set_physics_process>`.
  641. Corresponds to the :ref:`NOTIFICATION_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_PHYSICS_PROCESS>` notification in :ref:`Object._notification<class_Object_method__notification>`.
  642. \ **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
  643. .. rst-class:: classref-item-separator
  644. ----
  645. .. _class_Node_method__process:
  646. .. rst-class:: classref-method
  647. void **_process** **(** :ref:`float<class_float>` delta **)** |virtual|
  648. Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the ``delta`` time since the previous frame is not constant. ``delta`` is in seconds.
  649. It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_process<class_Node_method_set_process>`.
  650. Corresponds to the :ref:`NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>` notification in :ref:`Object._notification<class_Object_method__notification>`.
  651. \ **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
  652. .. rst-class:: classref-item-separator
  653. ----
  654. .. _class_Node_method__ready:
  655. .. rst-class:: classref-method
  656. void **_ready** **(** **)** |virtual|
  657. Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their :ref:`_ready<class_Node_method__ready>` callbacks get triggered first, and the parent node will receive the ready notification afterwards.
  658. Corresponds to the :ref:`NOTIFICATION_READY<class_Node_constant_NOTIFICATION_READY>` notification in :ref:`Object._notification<class_Object_method__notification>`. See also the ``onready`` keyword for variables.
  659. Usually used for initialization. For even earlier initialization, :ref:`Object._init<class_Object_method__init>` may be used. See also :ref:`_enter_tree<class_Node_method__enter_tree>`.
  660. \ **Note:** :ref:`_ready<class_Node_method__ready>` may be called only once for each node. After removing a node from the scene tree and adding it again, ``_ready`` will not be called a second time. This can be bypassed by requesting another call with :ref:`request_ready<class_Node_method_request_ready>`, which may be called anywhere before adding the node again.
  661. .. rst-class:: classref-item-separator
  662. ----
  663. .. _class_Node_method__unhandled_input:
  664. .. rst-class:: classref-method
  665. void **_unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  666. Called when an :ref:`InputEvent<class_InputEvent>` hasn't been consumed by :ref:`_input<class_Node_method__input>` or any GUI :ref:`Control<class_Control>` item. The input event propagates up through the node tree until a node consumes it.
  667. It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_process_unhandled_input<class_Node_method_set_process_unhandled_input>`.
  668. To consume the input event and stop it propagating further to other nodes, :ref:`SceneTree.set_input_as_handled<class_SceneTree_method_set_input_as_handled>` can be called.
  669. For gameplay input, this and :ref:`_unhandled_key_input<class_Node_method__unhandled_key_input>` are usually a better fit than :ref:`_input<class_Node_method__input>` as they allow the GUI to intercept the events first.
  670. \ **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_Node_method__unhandled_key_input:
  674. .. rst-class:: classref-method
  675. void **_unhandled_key_input** **(** :ref:`InputEventKey<class_InputEventKey>` event **)** |virtual|
  676. Called when an :ref:`InputEventKey<class_InputEventKey>` hasn't been consumed by :ref:`_input<class_Node_method__input>` or any GUI :ref:`Control<class_Control>` item. The input event propagates up through the node tree until a node consumes it.
  677. It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_process_unhandled_key_input<class_Node_method_set_process_unhandled_key_input>`.
  678. To consume the input event and stop it propagating further to other nodes, :ref:`SceneTree.set_input_as_handled<class_SceneTree_method_set_input_as_handled>` can be called.
  679. For gameplay input, this and :ref:`_unhandled_input<class_Node_method__unhandled_input>` are usually a better fit than :ref:`_input<class_Node_method__input>` as they allow the GUI to intercept the events first.
  680. \ **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
  681. .. rst-class:: classref-item-separator
  682. ----
  683. .. _class_Node_method_add_child:
  684. .. rst-class:: classref-method
  685. void **add_child** **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` force_readable_name=false **)**
  686. Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.
  687. If ``force_readable_name`` is ``true``, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares :ref:`name<class_Node_property_name>` with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to ``false``, which assigns a dummy name featuring ``@`` in both situations.
  688. \ **Note:** If the child node already has a parent, the function will fail. Use :ref:`remove_child<class_Node_method_remove_child>` first to remove the node from its current parent. For example:
  689. ::
  690. if child_node.get_parent():
  691. child_node.get_parent().remove_child(child_node)
  692. add_child(child_node)
  693. \ **Note:** If you want a child to be persisted to a :ref:`PackedScene<class_PackedScene>`, you must set :ref:`owner<class_Node_property_owner>` in addition to calling :ref:`add_child<class_Node_method_add_child>`. This is typically relevant for :doc:`tool scripts <../tutorials/plugins/running_code_in_the_editor>` and :doc:`editor plugins <../tutorials/plugins/editor/index>`. If :ref:`add_child<class_Node_method_add_child>` is called without setting :ref:`owner<class_Node_property_owner>`, the newly added **Node** will not be visible in the scene tree, though it will be visible in the 2D/3D view.
  694. .. rst-class:: classref-item-separator
  695. ----
  696. .. _class_Node_method_add_child_below_node:
  697. .. rst-class:: classref-method
  698. void **add_child_below_node** **(** :ref:`Node<class_Node>` node, :ref:`Node<class_Node>` child_node, :ref:`bool<class_bool>` force_readable_name=false **)**
  699. Adds ``child_node`` as a child. The child is placed below the given ``node`` in the list of children.
  700. If ``force_readable_name`` is ``true``, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares :ref:`name<class_Node_property_name>` with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to ``false``, which assigns a dummy name featuring ``@`` in both situations.
  701. .. rst-class:: classref-item-separator
  702. ----
  703. .. _class_Node_method_add_to_group:
  704. .. rst-class:: classref-method
  705. void **add_to_group** **(** :ref:`String<class_String>` group, :ref:`bool<class_bool>` persistent=false **)**
  706. Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see :ref:`is_inside_tree<class_Node_method_is_inside_tree>`). See notes in the description, and the group methods in :ref:`SceneTree<class_SceneTree>`.
  707. The ``persistent`` option is used when packing node to :ref:`PackedScene<class_PackedScene>` and saving to file. Non-persistent groups aren't stored.
  708. \ **Note:** For performance reasons, the order of node groups is *not* guaranteed. The order of node groups should not be relied upon as it can vary across project runs.
  709. .. rst-class:: classref-item-separator
  710. ----
  711. .. _class_Node_method_can_process:
  712. .. rst-class:: classref-method
  713. :ref:`bool<class_bool>` **can_process** **(** **)** |const|
  714. Returns ``true`` if the node can process while the scene tree is paused (see :ref:`pause_mode<class_Node_property_pause_mode>`). Always returns ``true`` if the scene tree is not paused, and ``false`` if the node is not in the tree.
  715. .. rst-class:: classref-item-separator
  716. ----
  717. .. _class_Node_method_create_tween:
  718. .. rst-class:: classref-method
  719. :ref:`SceneTreeTween<class_SceneTreeTween>` **create_tween** **(** **)**
  720. Creates a new :ref:`SceneTreeTween<class_SceneTreeTween>` and binds it to this node. This is equivalent of doing:
  721. ::
  722. get_tree().create_tween().bind_node(self)
  723. .. rst-class:: classref-item-separator
  724. ----
  725. .. _class_Node_method_duplicate:
  726. .. rst-class:: classref-method
  727. :ref:`Node<class_Node>` **duplicate** **(** :ref:`int<class_int>` flags=15 **)** |const|
  728. Duplicates the node, returning a new node.
  729. You can fine-tune the behavior using the ``flags`` (see :ref:`DuplicateFlags<enum_Node_DuplicateFlags>`).
  730. \ **Note:** It will not work properly if the node contains a script with constructor arguments (i.e. needs to supply arguments to :ref:`Object._init<class_Object_method__init>` method). In that case, the node will be duplicated without a script.
  731. .. rst-class:: classref-item-separator
  732. ----
  733. .. _class_Node_method_find_node:
  734. .. rst-class:: classref-method
  735. :ref:`Node<class_Node>` **find_node** **(** :ref:`String<class_String>` mask, :ref:`bool<class_bool>` recursive=true, :ref:`bool<class_bool>` owned=true **)** |const|
  736. Finds a descendant of this node whose name matches ``mask`` as in :ref:`String.match<class_String_method_match>` (i.e. case-sensitive, but ``"*"`` matches zero or more characters and ``"?"`` matches any single character except ``"."``). Returns ``null`` if no matching **Node** is found.
  737. \ **Note:** It does not match against the full path, just against individual node names.
  738. If ``owned`` is ``true``, this method only finds nodes whose owner is this node. This is especially important for scenes instantiated through a script, because those scenes don't have an owner.
  739. \ **Note:** As this method walks through all the descendants of the node, it is the slowest way to get a reference to another node. Whenever possible, consider using :ref:`get_node<class_Node_method_get_node>` instead. To avoid using :ref:`find_node<class_Node_method_find_node>` too often, consider caching the node reference into a variable.
  740. .. rst-class:: classref-item-separator
  741. ----
  742. .. _class_Node_method_find_parent:
  743. .. rst-class:: classref-method
  744. :ref:`Node<class_Node>` **find_parent** **(** :ref:`String<class_String>` mask **)** |const|
  745. Finds the first parent of the current node whose name matches ``mask`` as in :ref:`String.match<class_String_method_match>` (i.e. case-sensitive, but ``"*"`` matches zero or more characters and ``"?"`` matches any single character except ``"."``).
  746. \ **Note:** It does not match against the full path, just against individual node names.
  747. \ **Note:** As this method walks upwards in the scene tree, it can be slow in large, deeply nested scene trees. Whenever possible, consider using :ref:`get_node<class_Node_method_get_node>` instead. To avoid using :ref:`find_parent<class_Node_method_find_parent>` too often, consider caching the node reference into a variable.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_Node_method_get_child:
  751. .. rst-class:: classref-method
  752. :ref:`Node<class_Node>` **get_child** **(** :ref:`int<class_int>` idx **)** |const|
  753. Returns a child node by its index (see :ref:`get_child_count<class_Node_method_get_child_count>`). This method is often used for iterating all children of a node.
  754. To access a child node via its name, use :ref:`get_node<class_Node_method_get_node>`.
  755. .. rst-class:: classref-item-separator
  756. ----
  757. .. _class_Node_method_get_child_count:
  758. .. rst-class:: classref-method
  759. :ref:`int<class_int>` **get_child_count** **(** **)** |const|
  760. Returns the number of child nodes.
  761. .. rst-class:: classref-item-separator
  762. ----
  763. .. _class_Node_method_get_children:
  764. .. rst-class:: classref-method
  765. :ref:`Array<class_Array>` **get_children** **(** **)** |const|
  766. Returns an array of references to node's children.
  767. .. rst-class:: classref-item-separator
  768. ----
  769. .. _class_Node_method_get_groups:
  770. .. rst-class:: classref-method
  771. :ref:`Array<class_Array>` **get_groups** **(** **)** |const|
  772. Returns an array listing the groups that the node is a member of.
  773. \ **Note:** For performance reasons, the order of node groups is *not* guaranteed. The order of node groups should not be relied upon as it can vary across project runs.
  774. \ **Note:** The engine uses some group names internally (all starting with an underscore). To avoid conflicts with internal groups, do not add custom groups whose name starts with an underscore. To exclude internal groups while looping over :ref:`get_groups<class_Node_method_get_groups>`, use the following snippet:
  775. ::
  776. # Stores the node's non-internal groups only (as an array of Strings).
  777. var non_internal_groups = []
  778. for group in get_groups():
  779. if not group.begins_with("_"):
  780. non_internal_groups.push_back(group)
  781. .. rst-class:: classref-item-separator
  782. ----
  783. .. _class_Node_method_get_index:
  784. .. rst-class:: classref-method
  785. :ref:`int<class_int>` **get_index** **(** **)** |const|
  786. Returns the node's index, i.e. its position among the siblings of its parent.
  787. .. rst-class:: classref-item-separator
  788. ----
  789. .. _class_Node_method_get_network_master:
  790. .. rst-class:: classref-method
  791. :ref:`int<class_int>` **get_network_master** **(** **)** |const|
  792. Returns the peer ID of the network master for this node. See :ref:`set_network_master<class_Node_method_set_network_master>`.
  793. .. rst-class:: classref-item-separator
  794. ----
  795. .. _class_Node_method_get_node:
  796. .. rst-class:: classref-method
  797. :ref:`Node<class_Node>` **get_node** **(** :ref:`NodePath<class_NodePath>` path **)** |const|
  798. Fetches a node. The :ref:`NodePath<class_NodePath>` can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, ``null`` is returned and an error is logged. Attempts to access methods on the return value will result in an "Attempt to call <method> on a null instance." error.
  799. \ **Note:** Fetching absolute paths only works when the node is inside the scene tree (see :ref:`is_inside_tree<class_Node_method_is_inside_tree>`).
  800. \ **Example:** Assume your current node is Character and the following tree:
  801. ::
  802. /root
  803. /root/Character
  804. /root/Character/Sword
  805. /root/Character/Backpack/Dagger
  806. /root/MyGame
  807. /root/Swamp/Alligator
  808. /root/Swamp/Mosquito
  809. /root/Swamp/Goblin
  810. Possible paths are:
  811. ::
  812. get_node("Sword")
  813. get_node("Backpack/Dagger")
  814. get_node("../Swamp/Alligator")
  815. get_node("/root/MyGame")
  816. .. rst-class:: classref-item-separator
  817. ----
  818. .. _class_Node_method_get_node_and_resource:
  819. .. rst-class:: classref-method
  820. :ref:`Array<class_Array>` **get_node_and_resource** **(** :ref:`NodePath<class_NodePath>` path **)**
  821. Fetches a node and one of its resources as specified by the :ref:`NodePath<class_NodePath>`'s subname (e.g. ``Area2D/CollisionShape2D:shape``). If several nested resources are specified in the :ref:`NodePath<class_NodePath>`, the last one will be fetched.
  822. The return value is an array of size 3: the first index points to the **Node** (or ``null`` if not found), the second index points to the :ref:`Resource<class_Resource>` (or ``null`` if not found), and the third index is the remaining :ref:`NodePath<class_NodePath>`, if any.
  823. For example, assuming that ``Area2D/CollisionShape2D`` is a valid node and that its ``shape`` property has been assigned a :ref:`RectangleShape2D<class_RectangleShape2D>` resource, one could have this kind of output:
  824. ::
  825. print(get_node_and_resource("Area2D/CollisionShape2D")) # [[CollisionShape2D:1161], Null, ]
  826. print(get_node_and_resource("Area2D/CollisionShape2D:shape")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], ]
  827. print(get_node_and_resource("Area2D/CollisionShape2D:shape:extents")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], :extents]
  828. .. rst-class:: classref-item-separator
  829. ----
  830. .. _class_Node_method_get_node_or_null:
  831. .. rst-class:: classref-method
  832. :ref:`Node<class_Node>` **get_node_or_null** **(** :ref:`NodePath<class_NodePath>` path **)** |const|
  833. Similar to :ref:`get_node<class_Node_method_get_node>`, but does not log an error if ``path`` does not point to a valid **Node**.
  834. .. rst-class:: classref-item-separator
  835. ----
  836. .. _class_Node_method_get_parent:
  837. .. rst-class:: classref-method
  838. :ref:`Node<class_Node>` **get_parent** **(** **)** |const|
  839. Returns the parent node of the current node, or ``null`` if the node lacks a parent.
  840. .. rst-class:: classref-item-separator
  841. ----
  842. .. _class_Node_method_get_path:
  843. .. rst-class:: classref-method
  844. :ref:`NodePath<class_NodePath>` **get_path** **(** **)** |const|
  845. Returns the absolute path of the current node. This only works if the current node is inside the scene tree (see :ref:`is_inside_tree<class_Node_method_is_inside_tree>`).
  846. .. rst-class:: classref-item-separator
  847. ----
  848. .. _class_Node_method_get_path_to:
  849. .. rst-class:: classref-method
  850. :ref:`NodePath<class_NodePath>` **get_path_to** **(** :ref:`Node<class_Node>` node **)** |const|
  851. Returns the relative :ref:`NodePath<class_NodePath>` from this node to the specified ``node``. Both nodes must be in the same scene or the function will fail.
  852. .. rst-class:: classref-item-separator
  853. ----
  854. .. _class_Node_method_get_physics_process_delta_time:
  855. .. rst-class:: classref-method
  856. :ref:`float<class_float>` **get_physics_process_delta_time** **(** **)** |const|
  857. Returns the time elapsed (in seconds) since the last physics-bound frame (see :ref:`_physics_process<class_Node_method__physics_process>`). This is always a constant value in physics processing unless the frames per second is changed via :ref:`Engine.iterations_per_second<class_Engine_property_iterations_per_second>`.
  858. .. rst-class:: classref-item-separator
  859. ----
  860. .. _class_Node_method_get_position_in_parent:
  861. .. rst-class:: classref-method
  862. :ref:`int<class_int>` **get_position_in_parent** **(** **)** |const|
  863. Returns the node's order in the scene tree branch. For example, if called on the first child node the position is ``0``.
  864. .. rst-class:: classref-item-separator
  865. ----
  866. .. _class_Node_method_get_process_delta_time:
  867. .. rst-class:: classref-method
  868. :ref:`float<class_float>` **get_process_delta_time** **(** **)** |const|
  869. Returns the time elapsed (in seconds) since the last process callback. This value may vary from frame to frame.
  870. .. rst-class:: classref-item-separator
  871. ----
  872. .. _class_Node_method_get_scene_instance_load_placeholder:
  873. .. rst-class:: classref-method
  874. :ref:`bool<class_bool>` **get_scene_instance_load_placeholder** **(** **)** |const|
  875. Returns ``true`` if this is an instance load placeholder. See :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  876. .. rst-class:: classref-item-separator
  877. ----
  878. .. _class_Node_method_get_tree:
  879. .. rst-class:: classref-method
  880. :ref:`SceneTree<class_SceneTree>` **get_tree** **(** **)** |const|
  881. Returns the :ref:`SceneTree<class_SceneTree>` that contains this node.
  882. .. rst-class:: classref-item-separator
  883. ----
  884. .. _class_Node_method_get_viewport:
  885. .. rst-class:: classref-method
  886. :ref:`Viewport<class_Viewport>` **get_viewport** **(** **)** |const|
  887. Returns the node's :ref:`Viewport<class_Viewport>`.
  888. .. rst-class:: classref-item-separator
  889. ----
  890. .. _class_Node_method_has_node:
  891. .. rst-class:: classref-method
  892. :ref:`bool<class_bool>` **has_node** **(** :ref:`NodePath<class_NodePath>` path **)** |const|
  893. Returns ``true`` if the node that the :ref:`NodePath<class_NodePath>` points to exists.
  894. .. rst-class:: classref-item-separator
  895. ----
  896. .. _class_Node_method_has_node_and_resource:
  897. .. rst-class:: classref-method
  898. :ref:`bool<class_bool>` **has_node_and_resource** **(** :ref:`NodePath<class_NodePath>` path **)** |const|
  899. Returns ``true`` if the :ref:`NodePath<class_NodePath>` points to a valid node and its subname points to a valid resource, e.g. ``Area2D/CollisionShape2D:shape``. Properties with a non-:ref:`Resource<class_Resource>` type (e.g. nodes or primitive math types) are not considered resources.
  900. .. rst-class:: classref-item-separator
  901. ----
  902. .. _class_Node_method_is_a_parent_of:
  903. .. rst-class:: classref-method
  904. :ref:`bool<class_bool>` **is_a_parent_of** **(** :ref:`Node<class_Node>` node **)** |const|
  905. Returns ``true`` if the given node is a direct or indirect child of the current node.
  906. .. rst-class:: classref-item-separator
  907. ----
  908. .. _class_Node_method_is_displayed_folded:
  909. .. rst-class:: classref-method
  910. :ref:`bool<class_bool>` **is_displayed_folded** **(** **)** |const|
  911. Returns ``true`` if the node is folded (collapsed) in the Scene dock. This method is only intended for use with editor tooling.
  912. .. rst-class:: classref-item-separator
  913. ----
  914. .. _class_Node_method_is_editable_instance:
  915. .. rst-class:: classref-method
  916. :ref:`bool<class_bool>` **is_editable_instance** **(** :ref:`Node<class_Node>` node **)** |const|
  917. Returns ``true`` if ``node`` has editable children enabled relative to this node. This method is only intended for use with editor tooling.
  918. .. rst-class:: classref-item-separator
  919. ----
  920. .. _class_Node_method_is_greater_than:
  921. .. rst-class:: classref-method
  922. :ref:`bool<class_bool>` **is_greater_than** **(** :ref:`Node<class_Node>` node **)** |const|
  923. Returns ``true`` if the given node occurs later in the scene hierarchy than the current node.
  924. .. rst-class:: classref-item-separator
  925. ----
  926. .. _class_Node_method_is_in_group:
  927. .. rst-class:: classref-method
  928. :ref:`bool<class_bool>` **is_in_group** **(** :ref:`String<class_String>` group **)** |const|
  929. Returns ``true`` if this node is in the specified group. See notes in the description, and the group methods in :ref:`SceneTree<class_SceneTree>`.
  930. .. rst-class:: classref-item-separator
  931. ----
  932. .. _class_Node_method_is_inside_tree:
  933. .. rst-class:: classref-method
  934. :ref:`bool<class_bool>` **is_inside_tree** **(** **)** |const|
  935. Returns ``true`` if this node is currently inside a :ref:`SceneTree<class_SceneTree>`.
  936. .. rst-class:: classref-item-separator
  937. ----
  938. .. _class_Node_method_is_network_master:
  939. .. rst-class:: classref-method
  940. :ref:`bool<class_bool>` **is_network_master** **(** **)** |const|
  941. Returns ``true`` if the local system is the master of this node.
  942. .. rst-class:: classref-item-separator
  943. ----
  944. .. _class_Node_method_is_node_ready:
  945. .. rst-class:: classref-method
  946. :ref:`bool<class_bool>` **is_node_ready** **(** **)** |const|
  947. Returns ``true`` if the node is ready, i.e. it's inside scene tree and all its children are initialized.
  948. \ :ref:`request_ready<class_Node_method_request_ready>` resets it back to ``false``.
  949. .. rst-class:: classref-item-separator
  950. ----
  951. .. _class_Node_method_is_physics_interpolated:
  952. .. rst-class:: classref-method
  953. :ref:`bool<class_bool>` **is_physics_interpolated** **(** **)** |const|
  954. Returns ``true`` if the physics interpolated flag is set for this Node (see :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>`).
  955. \ **Note:** Interpolation will only be active if both the flag is set **and** physics interpolation is enabled within the :ref:`SceneTree<class_SceneTree>`. This can be tested using :ref:`is_physics_interpolated_and_enabled<class_Node_method_is_physics_interpolated_and_enabled>`.
  956. .. rst-class:: classref-item-separator
  957. ----
  958. .. _class_Node_method_is_physics_interpolated_and_enabled:
  959. .. rst-class:: classref-method
  960. :ref:`bool<class_bool>` **is_physics_interpolated_and_enabled** **(** **)** |const|
  961. Returns ``true`` if physics interpolation is enabled (see :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>`) **and** enabled in the :ref:`SceneTree<class_SceneTree>`.
  962. This is a convenience version of :ref:`is_physics_interpolated<class_Node_method_is_physics_interpolated>` that also checks whether physics interpolation is enabled globally.
  963. See :ref:`SceneTree.physics_interpolation<class_SceneTree_property_physics_interpolation>` and :ref:`ProjectSettings.physics/common/physics_interpolation<class_ProjectSettings_property_physics/common/physics_interpolation>`.
  964. .. rst-class:: classref-item-separator
  965. ----
  966. .. _class_Node_method_is_physics_processing:
  967. .. rst-class:: classref-method
  968. :ref:`bool<class_bool>` **is_physics_processing** **(** **)** |const|
  969. Returns ``true`` if physics processing is enabled (see :ref:`set_physics_process<class_Node_method_set_physics_process>`).
  970. .. rst-class:: classref-item-separator
  971. ----
  972. .. _class_Node_method_is_physics_processing_internal:
  973. .. rst-class:: classref-method
  974. :ref:`bool<class_bool>` **is_physics_processing_internal** **(** **)** |const|
  975. Returns ``true`` if internal physics processing is enabled (see :ref:`set_physics_process_internal<class_Node_method_set_physics_process_internal>`).
  976. .. rst-class:: classref-item-separator
  977. ----
  978. .. _class_Node_method_is_processing:
  979. .. rst-class:: classref-method
  980. :ref:`bool<class_bool>` **is_processing** **(** **)** |const|
  981. Returns ``true`` if processing is enabled (see :ref:`set_process<class_Node_method_set_process>`).
  982. .. rst-class:: classref-item-separator
  983. ----
  984. .. _class_Node_method_is_processing_input:
  985. .. rst-class:: classref-method
  986. :ref:`bool<class_bool>` **is_processing_input** **(** **)** |const|
  987. Returns ``true`` if the node is processing input (see :ref:`set_process_input<class_Node_method_set_process_input>`).
  988. .. rst-class:: classref-item-separator
  989. ----
  990. .. _class_Node_method_is_processing_internal:
  991. .. rst-class:: classref-method
  992. :ref:`bool<class_bool>` **is_processing_internal** **(** **)** |const|
  993. Returns ``true`` if internal processing is enabled (see :ref:`set_process_internal<class_Node_method_set_process_internal>`).
  994. .. rst-class:: classref-item-separator
  995. ----
  996. .. _class_Node_method_is_processing_unhandled_input:
  997. .. rst-class:: classref-method
  998. :ref:`bool<class_bool>` **is_processing_unhandled_input** **(** **)** |const|
  999. Returns ``true`` if the node is processing unhandled input (see :ref:`set_process_unhandled_input<class_Node_method_set_process_unhandled_input>`).
  1000. .. rst-class:: classref-item-separator
  1001. ----
  1002. .. _class_Node_method_is_processing_unhandled_key_input:
  1003. .. rst-class:: classref-method
  1004. :ref:`bool<class_bool>` **is_processing_unhandled_key_input** **(** **)** |const|
  1005. Returns ``true`` if the node is processing unhandled key input (see :ref:`set_process_unhandled_key_input<class_Node_method_set_process_unhandled_key_input>`).
  1006. .. rst-class:: classref-item-separator
  1007. ----
  1008. .. _class_Node_method_move_child:
  1009. .. rst-class:: classref-method
  1010. void **move_child** **(** :ref:`Node<class_Node>` child_node, :ref:`int<class_int>` to_position **)**
  1011. Moves a child node to a different position (order) among the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful.
  1012. .. rst-class:: classref-item-separator
  1013. ----
  1014. .. _class_Node_method_print_stray_nodes:
  1015. .. rst-class:: classref-method
  1016. void **print_stray_nodes** **(** **)**
  1017. Prints all stray nodes (nodes outside the :ref:`SceneTree<class_SceneTree>`). Used for debugging. Works only in debug builds.
  1018. .. rst-class:: classref-item-separator
  1019. ----
  1020. .. _class_Node_method_print_tree:
  1021. .. rst-class:: classref-method
  1022. void **print_tree** **(** **)**
  1023. Prints the tree to stdout. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the :ref:`get_node<class_Node_method_get_node>` function.
  1024. \ **Example output:**\
  1025. ::
  1026. TheGame
  1027. TheGame/Menu
  1028. TheGame/Menu/Label
  1029. TheGame/Menu/Camera2D
  1030. TheGame/SplashScreen
  1031. TheGame/SplashScreen/Camera2D
  1032. .. rst-class:: classref-item-separator
  1033. ----
  1034. .. _class_Node_method_print_tree_pretty:
  1035. .. rst-class:: classref-method
  1036. void **print_tree_pretty** **(** **)**
  1037. Similar to :ref:`print_tree<class_Node_method_print_tree>`, this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the scene inspector. It is useful for inspecting larger trees.
  1038. \ **Example output:**\
  1039. ::
  1040. ┖╴TheGame
  1041. ┠╴Menu
  1042. ┃ ┠╴Label
  1043. ┃ ┖╴Camera2D
  1044. ┖╴SplashScreen
  1045. ┖╴Camera2D
  1046. .. rst-class:: classref-item-separator
  1047. ----
  1048. .. _class_Node_method_propagate_call:
  1049. .. rst-class:: classref-method
  1050. void **propagate_call** **(** :ref:`String<class_String>` method, :ref:`Array<class_Array>` args=[ ], :ref:`bool<class_bool>` parent_first=false **)**
  1051. Calls the given method (if present) with the arguments given in ``args`` on this node and recursively on all its children. If the ``parent_first`` argument is ``true``, the method will be called on the current node first, then on all its children. If ``parent_first`` is ``false``, the children will be called first.
  1052. .. rst-class:: classref-item-separator
  1053. ----
  1054. .. _class_Node_method_propagate_notification:
  1055. .. rst-class:: classref-method
  1056. void **propagate_notification** **(** :ref:`int<class_int>` what **)**
  1057. Notifies the current node and all its children recursively by calling :ref:`Object.notification<class_Object_method_notification>` on all of them.
  1058. .. rst-class:: classref-item-separator
  1059. ----
  1060. .. _class_Node_method_queue_free:
  1061. .. rst-class:: classref-method
  1062. void **queue_free** **(** **)**
  1063. Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to :ref:`Object.free<class_Object_method_free>`. Use :ref:`Object.is_queued_for_deletion<class_Object_method_is_queued_for_deletion>` to check whether a node will be deleted at the end of the frame.
  1064. \ **Important:** If you have a variable pointing to a node, it will *not* be assigned to ``null`` once the node is freed. Instead, it will point to a *previously freed instance* and you should validate it with :ref:`@GDScript.is_instance_valid<class_@GDScript_method_is_instance_valid>` before attempting to call its methods or access its properties.
  1065. \ **Note:** For efficiency reasons, the final order of deletion is not guaranteed.
  1066. .. rst-class:: classref-item-separator
  1067. ----
  1068. .. _class_Node_method_raise:
  1069. .. rst-class:: classref-method
  1070. void **raise** **(** **)**
  1071. Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs (:ref:`Control<class_Control>` nodes), because their order of drawing depends on their order in the tree. The top Node is drawn first, then any siblings below the top Node in the hierarchy are successively drawn on top of it. After using ``raise``, a Control will be drawn on top of its siblings.
  1072. .. rst-class:: classref-item-separator
  1073. ----
  1074. .. _class_Node_method_remove_and_skip:
  1075. .. rst-class:: classref-method
  1076. void **remove_and_skip** **(** **)**
  1077. Removes a node and sets all its children as children of the parent node (if it exists). All event subscriptions that pass by the removed node will be unsubscribed.
  1078. .. rst-class:: classref-item-separator
  1079. ----
  1080. .. _class_Node_method_remove_child:
  1081. .. rst-class:: classref-method
  1082. void **remove_child** **(** :ref:`Node<class_Node>` node **)**
  1083. Removes a child node. The node is NOT deleted and must be deleted manually.
  1084. \ **Note:** This function may set the :ref:`owner<class_Node_property_owner>` of the removed Node (or its descendants) to be ``null``, if that :ref:`owner<class_Node_property_owner>` is no longer a parent or ancestor.
  1085. .. rst-class:: classref-item-separator
  1086. ----
  1087. .. _class_Node_method_remove_from_group:
  1088. .. rst-class:: classref-method
  1089. void **remove_from_group** **(** :ref:`String<class_String>` group **)**
  1090. Removes a node from a group. See notes in the description, and the group methods in :ref:`SceneTree<class_SceneTree>`.
  1091. .. rst-class:: classref-item-separator
  1092. ----
  1093. .. _class_Node_method_replace_by:
  1094. .. rst-class:: classref-method
  1095. void **replace_by** **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` keep_data=false **)**
  1096. Replaces a node in a scene by the given one. Subscriptions that pass through this node will be lost.
  1097. \ **Note:** The given node will become the new parent of any child nodes that the replaced node had.
  1098. \ **Note:** The replaced node is not automatically freed, so you either need to keep it in a variable for later use or free it using :ref:`Object.free<class_Object_method_free>`.
  1099. .. rst-class:: classref-item-separator
  1100. ----
  1101. .. _class_Node_method_request_ready:
  1102. .. rst-class:: classref-method
  1103. void **request_ready** **(** **)**
  1104. Requests that ``_ready`` be called again. Note that the method won't be called immediately, but is scheduled for when the node is added to the scene tree again (see :ref:`_ready<class_Node_method__ready>`). ``_ready`` is called only for the node which requested it, which means that you need to request ready for each child if you want them to call ``_ready`` too (in which case, ``_ready`` will be called in the same order as it would normally).
  1105. .. rst-class:: classref-item-separator
  1106. ----
  1107. .. _class_Node_method_reset_physics_interpolation:
  1108. .. rst-class:: classref-method
  1109. void **reset_physics_interpolation** **(** **)**
  1110. When physics interpolation is active, moving a node to a radically different transform (such as placement within a level) can result in a visible glitch as the object is rendered moving from the old to new position over the physics tick.
  1111. This glitch can be prevented by calling ``reset_physics_interpolation``, which temporarily turns off interpolation until the physics tick is complete.
  1112. \ :ref:`NOTIFICATION_RESET_PHYSICS_INTERPOLATION<class_Node_constant_NOTIFICATION_RESET_PHYSICS_INTERPOLATION>` will be received by the node and all children recursively.
  1113. \ **Note:** This function should be called **after** moving the node, rather than before.
  1114. .. rst-class:: classref-item-separator
  1115. ----
  1116. .. _class_Node_method_rpc:
  1117. .. rst-class:: classref-method
  1118. :ref:`Variant<class_Variant>` **rpc** **(** :ref:`String<class_String>` method, ... **)** |vararg|
  1119. Sends a remote procedure call request for the given ``method`` to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same :ref:`NodePath<class_NodePath>`, including the exact same node name. Behaviour depends on the RPC configuration for the given method, see :ref:`rpc_config<class_Node_method_rpc_config>`. Methods are not exposed to RPCs by default. See also :ref:`rset<class_Node_method_rset>` and :ref:`rset_config<class_Node_method_rset_config>` for properties. Returns ``null``.
  1120. \ **Note:** You can only safely use RPCs on clients after you received the ``connected_to_server`` signal from the :ref:`SceneTree<class_SceneTree>`. You also need to keep track of the connection state, either by the :ref:`SceneTree<class_SceneTree>` signals like ``server_disconnected`` or by checking ``SceneTree.network_peer.get_connection_status() == CONNECTION_CONNECTED``.
  1121. .. rst-class:: classref-item-separator
  1122. ----
  1123. .. _class_Node_method_rpc_config:
  1124. .. rst-class:: classref-method
  1125. void **rpc_config** **(** :ref:`String<class_String>` method, :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>` mode **)**
  1126. Changes the RPC mode for the given ``method`` to the given ``mode``. See :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``master``, ``puppet``, ``remotesync``, ``mastersync``, ``puppetsync``). By default, methods are not exposed to networking (and RPCs). See also :ref:`rset<class_Node_method_rset>` and :ref:`rset_config<class_Node_method_rset_config>` for properties.
  1127. .. rst-class:: classref-item-separator
  1128. ----
  1129. .. _class_Node_method_rpc_id:
  1130. .. rst-class:: classref-method
  1131. :ref:`Variant<class_Variant>` **rpc_id** **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` method, ... **)** |vararg|
  1132. Sends a :ref:`rpc<class_Node_method_rpc>` to a specific peer identified by ``peer_id`` (see :ref:`NetworkedMultiplayerPeer.set_target_peer<class_NetworkedMultiplayerPeer_method_set_target_peer>`). Returns ``null``.
  1133. .. rst-class:: classref-item-separator
  1134. ----
  1135. .. _class_Node_method_rpc_unreliable:
  1136. .. rst-class:: classref-method
  1137. :ref:`Variant<class_Variant>` **rpc_unreliable** **(** :ref:`String<class_String>` method, ... **)** |vararg|
  1138. Sends a :ref:`rpc<class_Node_method_rpc>` using an unreliable protocol. Returns ``null``.
  1139. .. rst-class:: classref-item-separator
  1140. ----
  1141. .. _class_Node_method_rpc_unreliable_id:
  1142. .. rst-class:: classref-method
  1143. :ref:`Variant<class_Variant>` **rpc_unreliable_id** **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` method, ... **)** |vararg|
  1144. Sends a :ref:`rpc<class_Node_method_rpc>` to a specific peer identified by ``peer_id`` using an unreliable protocol (see :ref:`NetworkedMultiplayerPeer.set_target_peer<class_NetworkedMultiplayerPeer_method_set_target_peer>`). Returns ``null``.
  1145. .. rst-class:: classref-item-separator
  1146. ----
  1147. .. _class_Node_method_rset:
  1148. .. rst-class:: classref-method
  1149. void **rset** **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  1150. Remotely changes a property's value on other peers (and locally). Behaviour depends on the RPC configuration for the given property, see :ref:`rset_config<class_Node_method_rset_config>`. See also :ref:`rpc<class_Node_method_rpc>` for RPCs for methods, most information applies to this method as well.
  1151. .. rst-class:: classref-item-separator
  1152. ----
  1153. .. _class_Node_method_rset_config:
  1154. .. rst-class:: classref-method
  1155. void **rset_config** **(** :ref:`String<class_String>` property, :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>` mode **)**
  1156. Changes the RPC mode for the given ``property`` to the given ``mode``. See :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``master``, ``puppet``, ``remotesync``, ``mastersync``, ``puppetsync``). By default, properties are not exposed to networking (and RPCs). See also :ref:`rpc<class_Node_method_rpc>` and :ref:`rpc_config<class_Node_method_rpc_config>` for methods.
  1157. .. rst-class:: classref-item-separator
  1158. ----
  1159. .. _class_Node_method_rset_id:
  1160. .. rst-class:: classref-method
  1161. void **rset_id** **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  1162. Remotely changes the property's value on a specific peer identified by ``peer_id`` (see :ref:`NetworkedMultiplayerPeer.set_target_peer<class_NetworkedMultiplayerPeer_method_set_target_peer>`).
  1163. .. rst-class:: classref-item-separator
  1164. ----
  1165. .. _class_Node_method_rset_unreliable:
  1166. .. rst-class:: classref-method
  1167. void **rset_unreliable** **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  1168. Remotely changes the property's value on other peers (and locally) using an unreliable protocol.
  1169. .. rst-class:: classref-item-separator
  1170. ----
  1171. .. _class_Node_method_rset_unreliable_id:
  1172. .. rst-class:: classref-method
  1173. void **rset_unreliable_id** **(** :ref:`int<class_int>` peer_id, :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  1174. Remotely changes property's value on a specific peer identified by ``peer_id`` using an unreliable protocol (see :ref:`NetworkedMultiplayerPeer.set_target_peer<class_NetworkedMultiplayerPeer_method_set_target_peer>`).
  1175. .. rst-class:: classref-item-separator
  1176. ----
  1177. .. _class_Node_method_set_display_folded:
  1178. .. rst-class:: classref-method
  1179. void **set_display_folded** **(** :ref:`bool<class_bool>` fold **)**
  1180. Sets the folded state of the node in the Scene dock. This method is only intended for use with editor tooling.
  1181. .. rst-class:: classref-item-separator
  1182. ----
  1183. .. _class_Node_method_set_editable_instance:
  1184. .. rst-class:: classref-method
  1185. void **set_editable_instance** **(** :ref:`Node<class_Node>` node, :ref:`bool<class_bool>` is_editable **)**
  1186. Sets the editable children state of ``node`` relative to this node. This method is only intended for use with editor tooling.
  1187. .. rst-class:: classref-item-separator
  1188. ----
  1189. .. _class_Node_method_set_network_master:
  1190. .. rst-class:: classref-method
  1191. void **set_network_master** **(** :ref:`int<class_int>` id, :ref:`bool<class_bool>` recursive=true **)**
  1192. Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the ``master`` and ``puppet`` keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If ``recursive``, the given peer is recursively set as the master for all children of this node.
  1193. .. rst-class:: classref-item-separator
  1194. ----
  1195. .. _class_Node_method_set_physics_process:
  1196. .. rst-class:: classref-method
  1197. void **set_physics_process** **(** :ref:`bool<class_bool>` enable **)**
  1198. Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a :ref:`NOTIFICATION_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_PHYSICS_PROCESS>` at a fixed (usually 60 FPS, see :ref:`Engine.iterations_per_second<class_Engine_property_iterations_per_second>` to change) interval (and the :ref:`_physics_process<class_Node_method__physics_process>` callback will be called if exists). Enabled automatically if :ref:`_physics_process<class_Node_method__physics_process>` is overridden. Any calls to this before :ref:`_ready<class_Node_method__ready>` will be ignored.
  1199. .. rst-class:: classref-item-separator
  1200. ----
  1201. .. _class_Node_method_set_physics_process_internal:
  1202. .. rst-class:: classref-method
  1203. void **set_physics_process_internal** **(** :ref:`bool<class_bool>` enable **)**
  1204. Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal :ref:`_physics_process<class_Node_method__physics_process>` calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting (:ref:`set_physics_process<class_Node_method_set_physics_process>`). Only useful for advanced uses to manipulate built-in nodes' behavior.
  1205. \ **Warning:** Built-in Nodes rely on the internal processing for their own logic, so changing this value from your code may lead to unexpected behavior. Script access to this internal logic is provided for specific advanced uses, but is unsafe and not supported.
  1206. .. rst-class:: classref-item-separator
  1207. ----
  1208. .. _class_Node_method_set_process:
  1209. .. rst-class:: classref-method
  1210. void **set_process** **(** :ref:`bool<class_bool>` enable **)**
  1211. Enables or disables processing. When a node is being processed, it will receive a :ref:`NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>` on every drawn frame (and the :ref:`_process<class_Node_method__process>` callback will be called if exists). Enabled automatically if :ref:`_process<class_Node_method__process>` is overridden. Any calls to this before :ref:`_ready<class_Node_method__ready>` will be ignored.
  1212. .. rst-class:: classref-item-separator
  1213. ----
  1214. .. _class_Node_method_set_process_input:
  1215. .. rst-class:: classref-method
  1216. void **set_process_input** **(** :ref:`bool<class_bool>` enable **)**
  1217. Enables or disables input processing. This is not required for GUI controls! Enabled automatically if :ref:`_input<class_Node_method__input>` is overridden. Any calls to this before :ref:`_ready<class_Node_method__ready>` will be ignored.
  1218. .. rst-class:: classref-item-separator
  1219. ----
  1220. .. _class_Node_method_set_process_internal:
  1221. .. rst-class:: classref-method
  1222. void **set_process_internal** **(** :ref:`bool<class_bool>` enable **)**
  1223. Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal :ref:`_process<class_Node_method__process>` calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting (:ref:`set_process<class_Node_method_set_process>`). Only useful for advanced uses to manipulate built-in nodes' behavior.
  1224. \ **Warning:** Built-in Nodes rely on the internal processing for their own logic, so changing this value from your code may lead to unexpected behavior. Script access to this internal logic is provided for specific advanced uses, but is unsafe and not supported.
  1225. .. rst-class:: classref-item-separator
  1226. ----
  1227. .. _class_Node_method_set_process_unhandled_input:
  1228. .. rst-class:: classref-method
  1229. void **set_process_unhandled_input** **(** :ref:`bool<class_bool>` enable **)**
  1230. Enables unhandled input processing. This is not required for GUI controls! It enables the node to receive all input that was not previously handled (usually by a :ref:`Control<class_Control>`). Enabled automatically if :ref:`_unhandled_input<class_Node_method__unhandled_input>` is overridden. Any calls to this before :ref:`_ready<class_Node_method__ready>` will be ignored.
  1231. .. rst-class:: classref-item-separator
  1232. ----
  1233. .. _class_Node_method_set_process_unhandled_key_input:
  1234. .. rst-class:: classref-method
  1235. void **set_process_unhandled_key_input** **(** :ref:`bool<class_bool>` enable **)**
  1236. Enables unhandled key input processing. Enabled automatically if :ref:`_unhandled_key_input<class_Node_method__unhandled_key_input>` is overridden. Any calls to this before :ref:`_ready<class_Node_method__ready>` will be ignored.
  1237. .. rst-class:: classref-item-separator
  1238. ----
  1239. .. _class_Node_method_set_scene_instance_load_placeholder:
  1240. .. rst-class:: classref-method
  1241. void **set_scene_instance_load_placeholder** **(** :ref:`bool<class_bool>` load_placeholder **)**
  1242. Sets whether this is an instance load placeholder. See :ref:`InstancePlaceholder<class_InstancePlaceholder>`.
  1243. .. rst-class:: classref-item-separator
  1244. ----
  1245. .. _class_Node_method_update_configuration_warning:
  1246. .. rst-class:: classref-method
  1247. void **update_configuration_warning** **(** **)**
  1248. Updates the warning displayed for this node in the Scene Dock.
  1249. Use :ref:`_get_configuration_warning<class_Node_method__get_configuration_warning>` to setup the warning message to display.
  1250. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1251. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1252. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1253. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`