Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.EventSystems;
- public class UnityChanController : MonoBehaviour
- {
- private Animator anim;
- private AnimatorStateInfo info;
- void Start()
- {
- anim = GetComponent<Animator>();
- info = anim.GetCurrentAnimatorStateInfo(0);
- }
- public void OnClick()
- {
- Debug.Log("Touch");
- anim.SetBool("Next", true);
- StartCoroutine(StartMotion());
- anim.SetBool("Next", false);
- }
- IEnumerator StartMotion()
- {
- anim.Update(0);
- info = anim.GetCurrentAnimatorStateInfo(0);
- Debug.Log(info.length);
- yield return new WaitForSeconds(info.length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement