Ok I’ve had this problem for a while now, basically I am trying to spawn a cube prefab on a empty game object.Here is my script.
using UnityEngine;
using System.Collections;
public class Spawner : MonoBehaviour{
public GameObject Cube;
public float spawnTimeDelay = 3f;
public float spawnTimeInGame = 2f;
public Vector3 spawnLocation = new Vector3 (0,2,0);
void Spawn ()
{
GameObject SpawnLocation = (GameObject) Instantiate ( Cube, spawnLocation, Quaternion.identity);
}
// Use this for initialization
void Start ()
{
InvokeRepeating ("Spawn", spawnTimeDelay, spawnTimeInGame);
}
}