title: Unity 2D. How to rotate an object smoothly inside a Coroutine?
body: <p>I'm newbie here, but will try to describe as clear as I can. <em>(it's not that important, just to clarify)</em> So I want to rotate an object for 405deg in 1 second <strong>only once</strong>, when space is pressed. I've thought it should be done using coroutines, so I've wrote something like this:</p>
  <pre><code>private void Update()
      {
          if (Input.GetKeyDown(KeyCode.Space))
          {
              StopAllCoroutines(); //to prevent overlapping
              StartCoroutine(Rotate());
          }
      }
  
      IEnumerator Rotate()
      {
          //where final finalRotation is a rotation i want to get in a result
          Quaternion finalRotation = Quaternion.Euler(0, 0, 405) * transform.rotation;
  /*
  using do..while to make sure that object will rotate even in case it's in same rotation as finalRotation
  */
          do
          {
              //should smoothly rotate an object for 405deg in 1 sec but it doesnt
              transform.Rotate(Vector3.forward, 405f * Time.deltaTime / 1f);
          } while (transform.rotation != finalRotation);
          yield return 1;
      }
  </code></pre>
  <p>The code above works fine and everything is ok except one, it rotates an object <strong>instantly and not smoothly</strong>. I mean, if I use that line of code in Update, everything go smoothly</p>
  <pre><code>transform.Rotate(Vector3.forward, 405f * Time.deltaTime / 1f);
  </code></pre>
  <p><strong>So my questions:</strong></p>
  <ol>
  <li><p>Why does it rotate smoothly in Update, but instantly in the coroutine;</p>
  </li>
  <li><p>and how can that be fixed?</p>
  </li>
  </ol>
  <p><em>Thanks in advance, once again, sorry if I made some mistakes when making a topic.</em></p>