Hey Guys,
I got a question.
I wanna put some objects in my scene where one could click on and then a transparent box is appearing with some text in it.
So what is the best way to do that and how?
For every object the text should be different.
Sorry if you think thats a stupid question but I cant figure it out myself right now. I was searching in the GUI sections but didnt really find anything suiting my needs.
so this is what I tried in some variations, but that doesnt seem to work.
var boxString = "This is just a test";
function OnMouseDown (){
GUI.Box (Rect (10,10,100,90), boxString);
}
I’ve seen this line
GUI.Box (Rect (10,10,100,90), boxString);
used in the OnGui function but I thought it can be used in the OnMouseDown function aswell.
I have to say I never coded in javascript before, but I have a little experience in C and Java, so I am aware of all that objecoriented stuff.
Is there anything like the Java API for Unity and javascript ? I am having trouble right now to find out what classes and functions etc. are available as there is no IDE like eclipse, where the IDE is showing you all the possible functions etc. while your coding. Or does such an IDE exist ?
I don’t know that GUI functions will work in OnMouseDown(). I would try setting a flag in OnMouseDown(), and then in OnGUI() rendering the box if the flag is set.