The issue here seems to be a lack of understanding about what function calls do, what variables are, and how types work. GUI.Box(…) returns “void”, which means it doesn’t send any data back to where you called it from. In that snippet of code you’re trying to define a bunch of items of type GUIText and then assign a “void” to them, which can’t be done.
OnGUI() is used for what is called an “Immediate mode” GUI. That is to say, the various functions draw to the screen, collect input, or otherwise do what they do immediately. They don’t return objects to do things with later, which appears to be how you’re trying to use it. When you type…
GUI.Box(new Rect(10, 10, 100, 100), "Blah");[/quote]
... a box labelled "Blah" gets drawn to the screen when that code is run. At no stage are you ever given a reference to that box that gets drawn, because it only exists [I]while it is being drawn*[/I].
[SIZE=1]* This is a simplification, but I think it addresses the concepts that are important here.[/SIZE]
After asking for help in an online community it’s courteous and good form to come back and share your solution if you find one somewhere else or figure it out for yourself. The people helping you might not need it, but other people like you who search for it in the future might find it useful.
Hmm… sort of. Collisions are always checked against “invisible” things because the collision data is distinct from the rendering data. But…
… I’m not sure what you’re getting at here, and unless you’re playing with the skins somewhere your GUI.Button should be drawing something - it shouldn’t be “invisible” unless you’ve made it that way.
Anyhow, point is that the better you understand your tool the more you can do with them.