# Pause on scrolling backgrounds

I have a typical parallax backgrounds. They are scrolling by

public float Speed=0f;

void Update ()
{
renderer.material.mainTextureOffset = new Vector2 (Time.time*Speed,0);
}


I have a character. OnKeyDown he starts to move: Speed of background sets to 0.4f for example. OnKeyUp a character stops by setting the speed of background 0f. The problem is: when backgrounds stop to scroll, they return to its start position. They must just to pause the position. How to do?

renderer.material.mainTextureOffset += new Vector2 (Time.detlaTime*Speed,0);

Then, when you come back from a pause, the mainTextureOffset is where you left it.