Does Unity have an Onclick type function for game menus?
Answer by Peter G
May 10, 2010 at 10:10 PM
Yes, there are several options. You could use the GUI 2.0 scripting interface which automatically handles input. Found here.
Or you can use GUITextures and then use OnMouseDown() in a script to act as a button click.
Found here and here.
Both have their advantages. GUI 2.0 is slightly easier, because it takes care of most of the input handling, but GUITextures would allow you to be very precise and have more control over the button/ menu.
Any luck? Remember to select an answer as the right one so the next person to see this question knows how to solve the problem.
I'll upvote it - good luck getting a checkmark. :)
Thanks :) [Space Filler. Gotta get to 15 chars.]
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
No one has followed this question yet.
Can I make the name of a custom Menu Item context-sensitive, or show/hide it dynamically?
My inventory scripts
Mapping Function Keys to Menuitem
Different physic behaviour when use @MenuItem
How can I find the world position of the center of the Scene view?