// Animancer // https://kybernetik.com.au/animancer // Copyright 2022 Kybernetik // #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value. using UnityEngine; namespace Animancer.Examples.Basics { /// Plays an animation to demonstrate the basic usage of Animancer. /// /// If you actually want to only play one animation on an object and don't need any of the other features of /// Animancer, you can use the component to do so without needing an extra script. /// /// Quick Play /// https://kybernetik.com.au/animancer/api/Animancer.Examples.Basics/PlayAnimationOnEnable /// [AddComponentMenu(Strings.ExamplesMenuPrefix + "Basics - Play Animation On Enable")] [HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Basics) + "/" + nameof(PlayAnimationOnEnable))] public sealed class PlayAnimationOnEnable : MonoBehaviour { /************************************************************************************************************************/ [SerializeField] private AnimancerComponent _Animancer; [SerializeField] private AnimationClip _Animation; /************************************************************************************************************************/ private void OnEnable() { _Animancer.Play(_Animation); } /************************************************************************************************************************/ } }