I am making an 2D endless racing game in which the road is moving by default, but I want to make the road move faster when I click with leftmousebutton so It would seem like the car is boosted.
(offset is of the road texture which is on a Quad).
public class RoadMove : MonoBehaviour
{
public float speed;
Vector2 offset;
void Update()
{
offset = new Vector2(0, Time.time * speed);
GetComponent<Renderer>().material.mainTextureOffset = offset;
}
}
Can someone help me with this ?
Thanks