title: Unity: how to make the update() function wait a few seconds
body: <p>so Im trying to make my update() function wait a few seconds every time when the player presses the button "C" because every time when the player presses the key "c" it resets the rotation of the object and Im trying to make my game wait a few seconds because it will make some small animation of the object resets his rotation values.                                                 </p>
  
  <pre><code>void Reset()
  {
      Vector3 newRotation = 
      gameObject.transform.rotation.eulerAngles;
  
      if (Input.GetKeyDown(KeyCode.C))
      {
  
          x = newRotation.x;
          y = newRotation.y;
          z = newRotation.z;
  
          x = Mathf.Round(x);
          y = Mathf.Round(y);
          z = Mathf.Round(z);
  
          yield return new WaitForSeconds(1);
  
          print(x + " " + y + " " + z);
  
          for (; x &gt;= 0; x--)
          {
  
              arotation.x = x;
              boxy.transform.Rotate(arotation.x, y, z);
              if (x == 0)
              {
                  for (; y &gt;= 0; y--)
                  {
                      arotation.y = y;
                      boxy.transform.Rotate(arotation.x, arotation.y, z);
  
                      if (y == 0)
                      {
                          for (; z &gt;= 0; z--)
                          {
                              arotation.z = z;
                              boxy.transform.Rotate(arotation.x, arotation.y, arotation.z);
                          }
                      }
                  }
              }
          }
          print(x + " " + y + " " + z);
      }
  }
  </code></pre>