Lets say I have a tree and when I click on the tree I want a gui to show up.
What is the best way to do this?
A. Make a prfab of the gui and use instantiate(if even possible)
B. Usegui.enable = true…how would I make it not show up in my game preview using this method?
c. create the gui in teh script.
Basically I have the tree script working with onmouseup(), I just need to know how to make it show the gui once it is clicked
thanks
i finally got gui.drawtexture to work the way I need though I still do not know if this is the best way.
basically
var backtexture : Texture;
var quitbutt : Texture;
var drawprogress =0;
var buttonstyle : GUIStyle;
function OnGUI()
{
if (drawprogress == 1)
{
GUI.DrawTexture( Rect(110,110,300,300),backtexture);
//////////////quit button///////////////
if (GUI.Button(Rect(355,372,27,27), quitbutt))
{
drawprogress = 0;
}
}}
function OnMouseUp()
{
drawprogress = 1;
}
I then attach this to the tree so when I click on the tree it shows the gui. If I click the quit button it closes the gui.
Yeah that is exactly how I have been doing until now.
var guiflag = 0;
function yourfunction{
guiflag = 1;
}
function OnGUI() {
if(guiflag)
{
GUI.BOX(Rect(0,0,200,200))
if(GUI.Button(Rect(0,0,20,20),“Done”))
guiflag = 0;
}
}
This extra step is to close the GUI box once your job is done. Is there any other way to do this? It is not good to associate 20 different variables for 20 different GUI styles.