Spawn At Spawnpoint

Hey guys

I tried to Spawn The Drone At the Position of the spawn point But It doen not work??

using UnityEngine;
using System.Collections;

public class Dronesspawn : MonoBehaviour
{
    public Transform SpawnPoint;
    public GameObject Drones;
    public float spawnTime = 5f;
    // Use this for initialization
    void Start()
    {
        InvokeRepeating("DronesSpawn", spawnTime, spawnTime);
    }

    // Update is called once per frame
    void Update()
    {
    }
    void DronesSpawn ()
    {
        //  I tried to Spawn The Drone At the Position of the spawn point ( The SpawnPoint Will Be moving!! ).But It Does not Work?
        var newpDronesspawn = GameObject.Instantiate(Drones), SpawnPoint.transform.position,transform.rotation);
    }
}

From the code you gave, the Instantiation doesn’t look quite right.

var newpDroneSpawn = (GameObject) Instantiate(Drones,SpawnPoint.transform.position,transform.rotation);

Given that you set up the references properly, this will instantiate a drone at the current position of the spawnPoint.

Pretty simple in C#:

public Transform Spawnpoint;
public GameObject Spawnobject;

void Spawntheobject()
{
Instantiate(Spawnobject, Spawnpoint.transform.position, Quaternion.identity);
}

Also when asking questions don’t say “it does not work”. Please be as specific as possible as people answering your question have no idea about what you’re seeing or your project.