PackedScene

    Category: Core

    An abstraction of a serialized scene.

    Properties

    can_instance ( ) const
    get_state ( )
    instance ( edit_state=0 ) const
    Error ( Node path )

    Enumerations

    enum GenEditState:

    • GEN_EDIT_STATE_DISABLED = 0 — If passed to , blocks edits to the scene state.
    • GEN_EDIT_STATE_INSTANCE = 1 — If passed to instance, provides local scene resources to the local scene. Requires tools compiled.

    Can be used to save a node to a file. When saving, the node as well as all the node it owns get saved (see property on ). Note that the node doesn’t need to own itself.

    Example of saving a node with different owners: The following example creates 3 objects: Node2D (node), RigidBody2D (rigid) and (collision). collision is a child of rigid which is a child of node. Only is owned by node and pack will therefore only save those two nodes, but not collision.

    Property Descriptions

    A dictionary representation of the scene contents.

    • can_instance ( ) const

    Returns true if the scene file has nodes.


    Returns the representing the scene file contents.


    Instantiates the scene’s node hierarchy. Triggers child scene instantiation(s). Triggers a notification on the root node.