I’m trying to make a game that you can spawn objects with simply pressing the number keys.
and it’s working great so far, but for some reason I can’t spawn the third object
can someone help me?
here’s the code:
using UnityEngine;
using System.Collections;
public class spawnscript : MonoBehaviour {
public GameObject cubeprefab;
public GameObject rectangleprefab;
public GameObject stairprefab;
public GameObject spawncube;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown("1"))
{
if(idea.Instance.shadow1 == true)
{
//Vector3 position = new Vector3(camera.transform.position.x + 2, camera.transform.position.y);
Instantiate(cubeprefab, transform.position, transform.rotation);
//Physics.IgnoreCollision(cubeprefab.collider, spawncube.collider);
}
}
if(Input.GetKeyDown("2"))
{
if(idea.Instance.shadow2 == true)
{
Instantiate(rectangleprefab, transform.position, transform.rotation);
}
if(Input.GetKeyDown("3"))
{
//if(idea.Instance.shadow3 == true)
//{
Instantiate(stairprefab, transform.position, transform.rotation);
//}
}
}
}
}