- Home /
GUI button is moving/disappearing when animation is played
Here's my script:
 public float speed=1f;
 public GameObject player;
 public GUITexture myTexture;
 public bool moving = false;
 public Animator anim;
 void Start()
 {
     anim = GetComponent<Animator> ();
     
 }
 void Update()
 {
     anim.SetBool ("Moving", moving);
     if (Input.GetMouseButton (0) && myTexture.HitTest (Input.mousePosition)) {
         moving = true;
         Debug.Log (moving);
         player.transform.position += Vector3.down * speed * Time.deltaTime;
             } else
                     moving = false;
 }
     }
I want when clicking on the button a continuous animation to be played on the player. Nor animation is played, nor tha button is staying on its place. What can I do?
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Unity GUI 4.6 stops animation 0 Answers
Animated GUI sprite not animating. 0 Answers
Animation Vs Animator 2 Answers
Trying to code a simple animation, please help. 1 Answer
2D Animation does not start 1 Answer
