init(animations:automaticallyPlaysDefaultAnimation:)
Creates an animation library from a dictionary that associates an animation’s data with its name.
Declaration
init(animations: [String : AnimationResource], automaticallyPlaysDefaultAnimation: Bool)Parameters
- animations:
A dictionary of animation resources that you key by name.
- automaticallyPlaysDefaultAnimation:
Whether to automatically play the default animation when the entity is added to a scene and enabled. When
true, the animation system plays the default animation automatically. Whenfalse, animations require manual playback. See Automaticallyplaysdefaultanimation for details.
Example
var library = AnimationLibraryComponent(
animations: ["walk": walkAnimation, "run": runAnimation],
automaticallyPlaysDefaultAnimation: true)
library.defaultKey = "walk"
entity.components.set(library)