I am trying to spawn objects and trying to use the variable frequency to drive the time gap between each call of the coroutine. but it spawns just one block. can anybody please help me with this
void Update () {
frequency = Mathf.Lerp(minMaxFrequency.x, minMaxFrequency.y, Difficulty.GetInterpolatedDifficultyPercent());
}
IEnumerator SpawnBlock()
{
while (true)
{
//process of spawning blocks.
yield return new WaitForSeconds(1.0f/frequency);
}
}
the frequency seems to increase as expected but the spawning is not.