Spawn Object On Gui (button Press)

So im trying to figure out when I left click my Gui button that it will spawn the object the Gui tells it to spawn.
a Script that “When it recives a left button click” it runs "Spawn Object (Name)

I have my own system put in of Object ID List,

var House : GameObject;

function Update() {
    if(Input.GetButtonUp("Jump"))
        Instantiate(House, transform.position, transform.rotation);
}

Please help thank you :slight_smile:

Try this on for size;
var House : GameObject
function Update(){
if(Input.GetButtonup("KeyCode.Space)){
Instantiate(House,transform.position,transform.rotation.

I think this’ll work but don’t have Unity here to try it with

I’m not sure I understand exactly what you mean, but If you want an object to spawn whenever you left click anywhere on the screen - you could just do a check id the left mouse button is clicked.

function Update() 
{
    if(Input.GetMouseButtonDown(0))
    {
        Instantiate(House, transform.position, transform.rotation);
    }
}

Otherwise, If you want to spawn an object when you click on something(like a button), it’s basically the same procedure - you just put the code elsewhere.
You can find some good documentation of the Unity GUI-system here.

In the code you have there, If you haven’t changed any values in the Input Manager and initialized everything correctly - an object would spawn if you press space.