Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

InstancePlaceholder

Hérite de : Node < Object

Le nœud fictif pour le Node racine de la PackedScene.

Description

Turning on the option Load As Placeholder for an instantiated scene in the editor causes it to be replaced by an InstancePlaceholder when running the game, this will not replace the node in the editor. This makes it possible to delay actually loading the scene until calling create_instance(). This is useful to avoid loading large scenes all at once by loading parts of it selectively.

Note: Like Node, InstancePlaceholder does not have a transform. This causes any child nodes to be positioned relatively to the Viewport origin, 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.

Méthodes

Node

create_instance(replace: bool = false, custom_scene: PackedScene = null)

String

get_instance_path() const

Dictionary

get_stored_values(with_order: bool = false)


Descriptions des méthodes

Node create_instance(replace: bool = false, custom_scene: PackedScene = null) 🔗

Appelez cette méthode pour réellement charger le nœud. Le nœudcréé sera placé comme un frère au-dessus du InstancePlaceholder dans l’arborescence de scène. La référence du Node est également renvoyée pour plus de commodité.

Note : create_instance() n'est pas thread-safe. Utilisez Object.call_deferred() si l'appelez à partir d'un thread.


String get_instance_path() const 🔗

Obtient le chemin vers le fichier de ressources PackedScene qui est chargé par défaut lors de l'appel à create_instance(). Non thread-safe. Utilisez Object.call_deferred() si vous l'appelez à partir d'un thread.


Dictionary get_stored_values(with_order: bool = false) 🔗

Renvoie la liste des propriétés qui seront appliquées au nœud lorsque create_instance() sera appelée.

Si with_order vaut true, une clé nommée .order (remarquez le point du début) est ajoutée au dictionnaire. Cette clé .order est un Array de String de noms de propriétés, spécifiant l'ordre dans lequel les propriétés seront appliquées (avec l'index 0 étant le premier).