Contents

automaticallyPlaysDefaultAnimation

Whether to automatically play the default animation when the entity is added to a scene and enabled. Default value is false, meaning the default animation will not be automatically played by default. This value can only be set when initializing AnimationLibraryComponent

Declaration

var automaticallyPlaysDefaultAnimation: Bool { get }

Return Value

  • true if automatically play default animation is enabled

  • false if automatically play default animation is disabled

Discussion

When set to true, the animation system automatically plays the default animation when the entity is added to a scene and enabled. The default animation is determined by defaultKey or, if that’s not set, the first animation in the library.

When set to false, animations require manual playback using playAnimation(_:transitionDuration:startsPaused:).

Example

var library = AnimationLibraryComponent(automaticallyPlaysDefaultAnimation: true)
library["idle"] = idleAnimation
library.defaultKey = "idle"
entity.components.set(library)
// Animation plays automatically when the entity is added to a scene and enabled

See Also

Configuring default playback