I have a problem . The game scenes lags . When I use this script for spawning the frames on low. It's not running 60fps . Another thing the enemy ai's stop spawning in the scene. I need help here is my code :
public class EnemiesSpawner : MonoBehaviour {
public GameObject enemy; public Transform [] spawnPoints;
public float spawnTime = 5f;
public Vector3 spawnValues;
void Start () {
InvokeRepeating("Spawn", spawnTime, spawnTime); //Calls the "Spawn" function every 10 seconds.
}
void Spawn () {
int spawnPointIndex = Random.Range (0, spawnPoints.Length);
for( int spawnCount = spawnPoints.Length - 1 ; spawnCount >= 0 ; --spawnCount )
Instantiate(enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
Vector3 s