Another action mouse after choice Gui button

Good Morning!!
I have a problem. I don´t know how to do this:
I have a GUI script to generate GUI game and I want that when I push in this button “palmeras” I want to do another action mouse later but in this context. I explain better again, I want to do that when I choose Palmeras in the GUI, I can place a palm in a position terrain I want with the mouse, but my problem is that I choose palm i dont know keep this choise for later to use the mouse to place the palm but I have to instantiate in the same code at instant but I can´t use the mouse to determinate the position.

How could I do this, please?
Thanks in advance

A piece of my code


if (GUI.Button (Rect (20, Screen.height / 2 - 30, 80, 20), “Palmeras”))
{

//I think here I need hold the script while I choose with mouse the palm position???
Instantiate(Palmeras, Input.mousePosition, transform.rotation);

}

I believe I have the solve. I use function OnMouseDown and I have created a var STRING to use in the code of the buttons GUI to difference between them then in the OnMouse… I wrote some IF to choose the button GUI down, like this:


if (GUI.Button (Rect (20, Screen.height / 2 - 30, 80, 20), “Palmeras”)) {

plantar = “palmeras”;
}

function OnMouseDown()
{
if(Input.GetMouseButton(0) plantar ==“palmeras”)
{
Instantiate(Palmeras, Input.mousePosition, transform.rotation);
Debug.Log(Input.mousePosition);
Debug.Log(“Pulsado palmeras”);
}
}

And run it!! and WORKS IT!

But now I need to know how instantiate the palm over the terrain obtaining the correct position with the mouse, because the code to instantiate don´t work how I have done it. IDEAS?

Thanks