My goal is to have a GUI appear when a collision is detected. I’ve got the collision detection part done, but the GUI doesn’t appear. I’ve gotten GUIs to appear before, so I don’t know exactly what I’m doing wrong. I guess part of my problem has to do with the way I have one function do something when another function returns true. I probably did that wrong, most of my coding experience is in Lua. And this isn’t Lua, so I’m probably doing something wrong there.
Can someone help or explain a better way to have a GUI appear when a collision is detected?
` function OnTriggerEnter (other : Collider) {
return (true);
}
function OnGUI () {
if OnTriggerEnter = true {
if (GUI.Button (Rect (10,10,150,100), "I am a button")) {
print ("You clicked the button!");
}
}
}
`
I'm not sure what your problem is.. But have you specified the Trigger checkbox for the GameObject's collider in the inspector?
– bionicnacho