tooltip question

Hi,

Is it possible to put a tooltip on the following in the GUI:

A texture
A vertical or horizontal slider

With regards to the slider it would be good if the tip only appeared when the mouse was over the thumb.

regards,

Tony

Yeah, it is possible… and pretty useful

it would be something like this for a button, and it’s the same for everything else.

var hover : String;


function OnGUI()
{
  if (GUI.Button(Rect(10,10,180,18),GUIContent("New Game", "New Game")))
  {    
  }
  hover=GUI.tooltip;
  if(hover=="New Game")
  {
    GUI.Label(Rect(10,20,180,18), "start a new game");
  }
}

Thanks Snake,

I can create hints for buttons and text areas but I don’t know how to do it for sliders and textures. Sliders and textures don’t take GUIContent as an argument and hence I don’t know how to pass in a tooltip, if indeed it is possible. A practical example of how to use tooltips with a slider control would be very useful.

regards,

Tony

what about Rect.Contains?

let’s say that the slider has this rect Rect (0, 0, 150, 150)…
a code like this one would work.

function Update ()
{
    var rect = Rect (0, 0, 150, 150);
    if (rect.Contains(Input.mousePosition))
        print("Inside");
}

code taken fron the script reference

:smile: :smile: :smile:

it’s not a tooltip thou and according to just taking into account the thumb of the slider hmmm I have no idea right now, but I’ll see if I can figure it out xD xD

good luck :smile: