I have created a float number called speed and ,in the update function, made it increase.
But it doesn’t actually increase.
It might be useful to know that the script is assigned to a prefab
Any help would be greatly appreciated
void Update()
{
transform.position += Vector3.left * speed * Time.deltaTime;
speed += 0.005f;
}
Hello.
First, is the speed variable defined as static? (you dont want it static).
Second, are you sure speed is not increasing? it should.
To be sure, add a debug.log ro know its value each time is used:
void Update()
{
Debug.Log(speed);
transform.position += Vector3.left * speed * Time.deltaTime;
speed += 0.005f;
}
And check the value. maybe is increasing very slow and you dont see it.
Byee!