Spawning Enemies

I am making a space shooter game and I want to spawn enemies like in Galaga. But I can’t seem to figure it out. Here is the code I have so far. If anyone could help me with this problem I would greatly appreciate it.

using UnityEngine;
using System.Collections;

public class Spawn : MonoBehaviour
{
    public GameObject [] spawnpoints;
    public GameObject Enemy;



    void start ()
    {
        spawnpoints = GameObject.FindGameObjectsWithTag("Spawnpoint");
         int spawn = Random.Range (3, spawnpoints.Length);
        Instantiate (Enemy, spawn.position, spawn.rotation);

    }
       
}
GameObject spawn = spawnpoints[Random.Range (3, spawnpoints.Length)];
Instantiate (Enemy, spawn.transform.position, spawn.transform.rotation);

you were close :slight_smile:

1 Like

Thanks for the help, but I still get an error when I updated my code. I get the error

"Type ‘UnityEngine.GameObject’ does not contain a definition for ‘position’ and ‘rotation’ and no extension method ‘position’ of type ‘UnityEngine.GameObject’ could be found. Are you missing an assembly reference?

Oh sorry, I made a mistake. Thank you so much for the help!