title: Unity prevent clicking for 1s
body: <p>I have a Unity Slidepuzzle-game(4x4) and i check where the open field is to move. I tried to make a slide animation with MoveTowards and that worked but now i have the problem that when i click two pieces (fast) that are next to the open space, both will move into it because the piece isnt fully there so the ray cant hit anything. P.S: it works without the animation but i just dont want the pieces to just teleport. i want a smooth slide.</p>
  
  <p>i tried solving it with a boolean so that when i click it moving is set to true and when the animation finished set to false again but that didnt work.</p>
  
  <pre><code>void MovePuzzle()
      {
          float duration = 0.5f;
  
          if(go_left)
          {
              Vector3 endPos1 = new Vector3(transform.position.x - move_amount.x, transform.position.y, transform.position.z);
              StartCoroutine(MoveTowards(endPos1, duration));
              go_left = false;
              moved = true;
          }
          if (go_right)
          {
              Vector3 endPos2 = new Vector3(transform.position.x + move_amount.x, transform.position.y, transform.position.z);
              StartCoroutine(MoveTowards(endPos2, duration));
              go_right = false;
              moved = true;
          }
          if (go_up)
          {
              Vector3 endPos3 = new Vector3(transform.position.x, transform.position.y + move_amount.y, transform.position.z);
              StartCoroutine(MoveTowards(endPos3, duration));
              go_up = false;
              moved = true;
          }
          if (go_down)
          {
              Vector3 endPos4 = new Vector3(transform.position.x, transform.position.y - move_amount.y, transform.position.z);
              StartCoroutine(MoveTowards(endPos4, duration)); 
              go_down = false;
              moved = true;
          }
      }
  
      IEnumerator MoveTowards(Vector3 toPosition, float duration)
      {
          float counter = 0;
  
          while (counter &lt; duration)
          {
              counter += Time.deltaTime;
              Vector3 currentPos = transform.position;
  
              float time = Vector3.Distance(currentPos, toPosition) / (duration - counter) * Time.deltaTime;
  
              transform.position = Vector3.MoveTowards(currentPos, toPosition, time);
  
              Debug.Log(counter + " / " + duration);
              yield return null;
          }
      }
  </code></pre>
  
  <p>Is there anyway to restrict clicks until the slide animation is finished?
  Im relativly new to Unity so dont expect to much knowledge from me :D.</p>