I am creating a demo in which I play two animation one is default which always run in background and one is when I clicked on my button. I want my default animation stops until my clicked animation not completed and when my clicked animation is complete i will play my default animation again.
using UnityEngine;
using System.Collections;
public class hump_movement : MonoBehaviour {
// Use this for initialization
public GUITexture humpbutton;
public AnimationClip humpanim;
public AnimationClip idle;
public bool myvar= false;
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButton (0) && humpbutton.HitTest (Input.mousePosition)) {
animation.Play(humpanim.name);
Debug.Log("1");
}
else if(!Input.GetMouseButton (0) && humpbutton.HitTest (Input.mousePosition)){
animation.Play (idle.name);
Debug.Log("2");
}
}
}
↧