SHARE
TWEET

Untitled

a guest Jun 15th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class SomeScript : MonoBehaviour {
  2.     public Animator ellen;
  3.     void Start() {
  4.         GetComponent<Button>().onClick.AddListener(delegate() {
  5.             ellen.SetTrigger(0);
  6.         });
  7.     }
  8. }
  9.      
  10. public class SomeScript : MonoBehaviour {
  11.     public Animator ellen;
  12.     public float audioDuration;
  13.     void Start() {
  14.         GetComponent<Button>().onClick.AddListener(delegate() {
  15.             StartCoroutine(TriggerAnimation());
  16.         });
  17.     }
  18.  
  19.     IEnumerator TriggerAnimation() {
  20.         ellen.SetTrigger(0);
  21.         yield return new WaitForSeconds(audioDuration);
  22.         ellen.ResetTrigger(0); //or however you want to return to the idle state
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top