InstancePlaceholder
Placeholder for the root Node
of a PackedScene
.
class InstancePlaceholder
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 createInstance(replace:customScene:)
. This is useful to avoid loading large scenes all at once by loading parts of it selectively.
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.
Superclasses
class Node
Base class for all scene objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func createInstance(replace: Bool, customScene: PackedScene?
) -> Node? Call this method to actually load in the node. The created node will be placed as a sibling above the
InstancePlaceholder
in the scene tree. TheNode
’s reference is also returned for convenience.func getInstancePath(
) -> String Gets the path to the
PackedScene
resource file that is loaded by default when callingcreateInstance(replace:customScene:)
. Not thread-safe. UseObject/callDeferred(method:)
if calling from a thread.func getStoredValues(withOrder: Bool
) -> GDictionary Returns the list of properties that will be applied to the node when
createInstance(replace:customScene:)
is called.