// Update is called once per frame void Update() { spawnTimer += Time.deltaTime; // Count up the timer if (spawnTimer >= spawnRate) // Has timer reached spawn rate? { // Loop through and spawn orcs and trolls for (int i = 0; i < spawnAmount; i++) { spawnCallback.Invoke(); } // Reset spawn timer spawnTimer = 0f; } }
// Update is called once per frame void Update() { // Count up the timer spawnTimer += Time.deltaTime; // Has timer reached spawn rate? if (spawnTimer >= spawnRate) { for (int i = 0; i < spawnAmount; i++) { spawnCallback.Invoke(); } // Reset spawn timer spawnTimer = 0f; } }