Hello my friends! In creating my own Runner game I’ve faced some problems!
Look at my script:
public Transform[] prefab = new Transform[12];
public Transform place;
void Update()
{
Vector3 CarPos = gameObject.transform.position;
CarPos.z = Monkey.distance + 30;
Instantiate(prefab[Random.Range(0, 12)], CarPos, place.rotation);
// I want some pause here, about 3 seconds
}
The point is, that these prefabs should appear in fornt of my runner - monkey. But because of Update function, they appear with every new frame. So I want to write something like: Pause 3seconds, and new object will appear 3 seconds later.
So is it possible to make a pause in script?
It is possible, do you know coroutines? You should read about them in case you do not know about them. They are a little bit tricky to use the first few times, but they will help you with what you want.