I am trying to add a textlabel or label with some text that pops up after the user clicks down on an object. For example, if I have an mesh of an apple on the screen and the user clicks on the apple, a label would appear that says, “apple”. However, currently in my script, as soon as the user lets go of the mouse click, the label disappears. I want the label to remain until the user navigates to another mesh and clicks it or goes back to click on the same structure again and have it disappear.
Currently what I have is:
var _mouseDown = false;
function OnGUI() {
if(_mouseDown) {
GUI.Box(Rect(10,10,100,20),"left femur!");
}
}
function OnMouseDown () {
_mouseDown = true;
}
function OnMouseUp () {
_mouseDown = false;
}
function OnMouseOut() {
_mouseDown = false;
}
How do I make the text disappear if I click on a separate object?
– Eowyn27