- Home /
Invisible tooltips
Is there a way to create "invisible" GUI tooltips? The thing is, I want to use tooltips to find out mouse position. I know that I can also do that using GetLastRect(), but "tooltip solution" seems a lot simpler.
Answer by Bunny83 · May 01, 2011 at 10:25 PM
Well, tooltips are "invisible" by default....
There are no standard visuals for tooltips. Just set your tooltip in your GUIContent for each element and you can query the GUI.tooltip property to see what's the current element. It will only show the string, you have to do the "match up" with your controls yourself.
There's an example at the bottom of the tooltip-property-page that uses the tooltip system to implement mouse over/out functionality.
Answer by GesterX · May 01, 2011 at 08:55 PM
The best way to get mouse position is to use Input.mousePosition which is documented here: http://unity3d.com/support/documentation/ScriptReference/Input-mousePosition.html
I'm not sure what the "Tooltip" solution is but I doubt it is simpler than one line of code which returns the exact co-ordinates.
You can also use the OnMouseOver function (and similar) to detect when the mouse is on an object if that is what you desire.
Feel free to elaborate if your situation cannot be resolved by using one of these methods.
Hah, you said exactly what I thought when I read the question! Just use Input.mousePosition :p
Something I've learnt from this website is when people are choiced with something simple that gives a "maths-based answer" or something messy that gives a "trigger-based answer"... most people will take the messy trigger based solution
Your answer
Follow this Question
Related Questions
Checking if mouse dragged from one point to another 2 Answers
Invisible mouse script? 1 Answer
Move object towards mouse position 1 Answer
How To Drag any Cube Using Mouse Click and Moved Only 1 Unit?? 2 Answers
Problems at using touch and buttons inputs,Problems at using touch input on Android 1 Answer