Created
October 11, 2022 15:51
-
-
Save mnogue/444e8ae96152f12673207b1311329d02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using UnityEngine.Playables; | |
public class PlayAnimation : MonoBehaviour | |
{ | |
public Animator animator; | |
public AnimationClip clip; | |
[NonSerialized] private PlayableGraph m_Graph; | |
private void OnEnable() | |
{ | |
AnimationPlayableUtilities.PlayClip(this.animator, this.clip, out this.m_Graph); | |
} | |
private void OnDisable() | |
{ | |
this.m_Graph.Destroy(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment