Hi all, I have a game and I want to increase the speed of the ground overtime. I have the following code but I’m not sure how to specify how long to take before it increases it’s speed?
using UnityEngine;
public class Ground : MonoBehaviour
{
public Material material;
public float speedMultiplier = 0.5f;
public float xVel = 0.1f;
Vector2 offset;
void Start()
{
material = GetComponent<Renderer>().material;
}
// Update is called once per frame
void Update()
{
offset = new Vector2(xVel, 0);
material.mainTextureOffset += offset * Time.deltaTime * speedMultiplier;
}
}