Hi, I’m trying to create a random spawn generator that spawns in prefabs at a slow paste and gradually increase the spawn rate of how many random objects is being spawned in. Can anyone help me achieve this? Thank you in advance!
float pace;
float reduction;
float timer;
void Start () {
//this is the start rate
pace = 10f;
//lower reduction number makes time incriment shrink faster between spawns
// this float should be between 0 and 1
reduction = 0.9f;
timer = pace;
}
void Update () {
timer += Time.deltaTime;
if (timer > pace) {
print ("spawn here...Time untill next spawn:"+pace);
pace=pace*reduction;
timer=0;
}
}