Hey all I have tried to spawn my cube for a while now I just used create.primitive to create the cube everytime the game is run on an empty spawn object. It clones the object in the hierarchy when I run the game but doesn’t show up when I run the game. Here i my code and a print screen if that helps.
using UnityEngine;
using System.Collections;
public class Spawner : MonoBehaviour{
public GameObject Cube;
public GameObject EmptyGameObject;
public float spawnTimeDelay = 3f;
public float spawnTimeInGame = 2f;
public Vector3 spawnLocation = new Vector3 (0,2,0);
void Spawner1 ()
{
Cube=GameObject.CreatePrimitive(PrimitiveType.Cube);
Cube.transform.position = new Vector3(transform.position.x,transform.position.y,transform.position.z);
}
// Use this for initialization
void Start ()
{
InvokeRepeating ("Spawner1", spawnTimeDelay, spawnTimeInGame);
}
}