class_instanceplaceholder.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the InstancePlaceholder.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_InstancePlaceholder:
  6. InstancePlaceholder
  7. ===================
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Placeholder for the root :ref:`Node<class_Node>` of a :ref:`PackedScene<class_PackedScene>`.
  13. Methods
  14. -------
  15. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`Node<class_Node>` | :ref:`create_instance<class_InstancePlaceholder_method_create_instance>` **(** :ref:`bool<class_bool>` replace=false, :ref:`PackedScene<class_PackedScene>` custom_scene=null **)** |
  17. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`String<class_String>` | :ref:`get_instance_path<class_InstancePlaceholder_method_get_instance_path>` **(** **)** const |
  19. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_stored_values<class_InstancePlaceholder_method_get_stored_values>` **(** :ref:`bool<class_bool>` with_order=false **)** |
  21. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`replace_by_instance<class_InstancePlaceholder_method_replace_by_instance>` **(** :ref:`PackedScene<class_PackedScene>` custom_scene=null **)** |
  23. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. Description
  25. -----------
  26. Turning on the option **Load As Placeholder** for an instanced scene in the editor causes it to be replaced by an InstancePlaceholder when running the game. This makes it possible to delay actually loading the scene until calling :ref:`replace_by_instance<class_InstancePlaceholder_method_replace_by_instance>`. This is useful to avoid loading large scenes all at once by loading parts of it selectively.
  27. The InstancePlaceholder does not have a transform. This causes any child nodes to be positioned relatively to the Viewport from point (0,0), rather than their parent as displayed in the editor. Replacing the placeholder with a scene with a transform will transform children relatively to their parent again.
  28. Method Descriptions
  29. -------------------
  30. .. _class_InstancePlaceholder_method_create_instance:
  31. - :ref:`Node<class_Node>` **create_instance** **(** :ref:`bool<class_bool>` replace=false, :ref:`PackedScene<class_PackedScene>` custom_scene=null **)**
  32. ----
  33. .. _class_InstancePlaceholder_method_get_instance_path:
  34. - :ref:`String<class_String>` **get_instance_path** **(** **)** const
  35. Retrieve the path to the :ref:`PackedScene<class_PackedScene>` resource file that is loaded by default when calling :ref:`replace_by_instance<class_InstancePlaceholder_method_replace_by_instance>`.
  36. ----
  37. .. _class_InstancePlaceholder_method_get_stored_values:
  38. - :ref:`Dictionary<class_Dictionary>` **get_stored_values** **(** :ref:`bool<class_bool>` with_order=false **)**
  39. ----
  40. .. _class_InstancePlaceholder_method_replace_by_instance:
  41. - void **replace_by_instance** **(** :ref:`PackedScene<class_PackedScene>` custom_scene=null **)**
  42. Replace this placeholder by the scene handed as an argument, or the original scene if no argument is given. As for all resources, the scene is loaded only if it's not loaded already. By manually loading the scene beforehand, delays caused by this function can be avoided.