I am trying to instantiate a prefab after a timer to create a wave spawning system for enemies. The problem is when I instantiate the prefab the enemy stats script works fine on it but then enemy AI script doesn’t work and the prefabs sit there doing nothing.
I looked up the issue and got a lot of people points towards using a prefab manager but I added one and the problem still persists.
void SpawnEnemy (Transform _enemy)
{
Debug.Log("Spawing enemy: " + _enemy.name);
Transform _sp = spawnpoints[Random.Range(0, spawnpoints.Length)];
Instantiate(PrefabManager.Instance.EnemyPrefab, _sp.position, _sp.rotation);
}
This is the code I’m using for spawning the enemy is there a better way of doing it that I’m mission out on?