IEnumerator spawn() { cLock = true; GameObject enemy = Instantiate(enemies, path == AIMovement.Paths.seaPath1 ? ai.seaPath1Spawn.transform.position : ai.seaPath2Spawn.transform.position, Quaternion.identity); /*ManaSystem.inst.gui.enemiesLeft[0]++; * ManaSystem.inst.gui.enemiesLeft[3]++;*/ ManaSystem.inst.gui.enemiesLeft++; enemy.GetComponent <AITemplate>().worldCanvas = ManaSystem.inst.worldSpaceCanvas; currentEnemySpawnCount++; if (currentEnemySpawnCount >= enemyBatchSpawnCount) { agent.enabled = true; ai.NextPointSea(agent, this); unloading = false; } yield return(new WaitForSeconds(time)); cLock = false; }