Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SomeScript : MonoBehaviour {
- public Animator ellen;
- void Start() {
- GetComponent<Button>().onClick.AddListener(delegate() {
- ellen.SetTrigger(0);
- });
- }
- }
- public class SomeScript : MonoBehaviour {
- public Animator ellen;
- public float audioDuration;
- void Start() {
- GetComponent<Button>().onClick.AddListener(delegate() {
- StartCoroutine(TriggerAnimation());
- });
- }
- IEnumerator TriggerAnimation() {
- ellen.SetTrigger(0);
- yield return new WaitForSeconds(audioDuration);
- ellen.ResetTrigger(0); //or however you want to return to the idle state
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement