diff --git a/Assets/Scripts/Enemy/EnemySpawner.cs b/Assets/Scripts/Enemy/EnemySpawner.cs index 1ba632a..c7d0018 100644 --- a/Assets/Scripts/Enemy/EnemySpawner.cs +++ b/Assets/Scripts/Enemy/EnemySpawner.cs @@ -78,7 +78,7 @@ public class EnemySpawner : NetworkBehaviour nextWaveRequested = false; timer = 0; } - + } public void StartSpawning() => SpawnerStarted = true; @@ -86,7 +86,7 @@ public class EnemySpawner : NetworkBehaviour void SpawnWave(float difficulty) { - if (enemyList.List.Any(x=>x.Difficulty < 0.1f)) + if (enemyList.List.Any(x => x.Difficulty < 0.1f)) { Debug.LogError("Difficulty on prefab too low!", enemyList); return; @@ -135,7 +135,10 @@ public class EnemySpawner : NetworkBehaviour GameObject enemy = Instantiate(enemyPrefab, GetRandomPointOnCircle(SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform); enemy.GetComponent().Spawn(); - enemy.GetComponent().targets = players.Select(x => x.transform).ToArray(); + if (players != null) + enemy.GetComponent().targets = players.Select(x => x.transform).ToArray(); + else + enemy.GetComponent().targets = new Transform[] { new GameObject("DummyTarget").transform}; } // Centrum is SpawnCenter