title: Apply movement for a specific interval
body: <p>I have a character in unity, I want to move it to the right for 3 seconds, and then move it to the left for 3 seconds, and again to the right and so on... like a loop movement.</p>
  
  <p>How can I do that? Is it possible to reset the time of Time.time?</p>
  
  <pre><code>void Update () {
  
          starttime = Time.time; 
  
          if (starttime &lt; 3)
          {
              rigidbody.AddForce(rigidbody.transform.TransformDirection((new Vector3(0, 0, 1)) * 5));
          }
  
  }
  </code></pre>