[Solved] Enemy ship not spawning

I just tried to create the EnemySpawner script, and I don’t get any errors, but when I run the game, the enemy ship doesn’t spawn.

Here’s my code:

    public GameObject enemyPrefab;

// Use this for initialization
void Start () {
	Instantiate(enemyPrefab, new Vector3(0f,0f,0f), Quaternion.identity);
}

And here’s a screenshot of my Unity screen:

Can anyone see anything I might have done wrong? Thanks!

Nevermind, I figured it out - I was attaching the script to my enemy ship prefab, rather than creating an enemy formation object and attaching it there.

1 Like