Display tooltips for objects in scene

Hello,

I’ve got a number of objects in a scene, which when clicked on display buttons (drawn with GUI.Button). The buttons are created in the scripts of the individual objects. I’ve also got a central, controlling object in the scene, which displays a tool-tip at the bottom of the screen. I’d like to display a tool-tip through this object when the user hovers over the buttons of the individual objects. Can anyone get me started in doing this?

Thanks for reading

1 Answer

1

In your central control object script, make a ‘static’ variable. This will make it accessible by any script in your scene. (javascript):

static var tooltipText : String;

Now in other scripts you should be able to do this:

ControlObjectScript.tooltipText = "This is now the tooltip text.";

Hope that helps!

Note that ‘static’ variables don’t show up in the inspector… for some reason.