- Home /
Detecting Which Button is Pressed on a Toolbar
Is it possible to detect which button on a toolbar is pressed? I can't find a answer and this is the closest thing I've found and it's no help.
Answer by SilverTabby · Aug 04, 2011 at 10:30 PM
Try using GUI.Toolbar. It returns an int which tells you what button is currently selected, then just check for a mouse press and use the int to determine what action to perform.
Yes, GUI.Toolbar is what I'm talking about(hints the "Toolbar" in the title) that doesn't help though because I want which button is pressed, not which button is selected.
Actually, which button is selected is all you need.
The only difference between selected and pressed is if Input.GetButton("$$anonymous$$ouse Button Name")
Answer by BerggreenDK · Aug 05, 2011 at 12:11 AM
How about using the RepeatButton instead and build your own toolbar with it?
http://unity3d.com/support/documentation/ScriptReference/GUI.RepeatButton.html
Dunno if you need a toolbar at all, this is just a single button.
Yeah I though about just making my own toolbar out of buttons but then I would lose the selected feature. I mean if it's not possible then I'll go to this but it just seems weird the way it's made out of buttons and there pressable and everything but yet you cant detect which one is pressed.
Your answer
Follow this Question
Related Questions
Unselecting a toolbar 1 Answer
GUI Button Disappearing 1 Answer
GUI Button for Android 1 Answer
Another GUI question. enable and disable 1 Answer
GUI button alpha images 1 Answer