title: How to stop Texture scrolling after certain time
body: <p>I have this code below which, just makes a scrolling background with a Quad. My question is how can I stop the scrolling of the background after a certain time. For example, I want after I reach the end of my scrolling image, the last visible piece to be locked as the background for the rest of the level. Since my player has a constant speed I imagined that something like: after maybe 20 seconds, stop scrolling and keep the image would be possible. I am really new to Unity and I am not really sure how to do it nor I found a way that works. I would appreciate the help!</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class BG : MonoBehaviour
  {
  
      public float speed;
      void Start()
      {
  
      }
      void Update()
      {
          Vector2 offset = new Vector2(0, Time.time * speed);
          GetComponent&lt;Renderer&gt;().material.mainTextureOffset = offset;
      }
  }
  </code></pre>