|
Hey, I am trying to use the standard GUI class to implement buttons... As far as just clicking them, everything was pretty easy:
However, if I want something different to happen when the user right-clicks the button, how could that be done? I'm thinking something like:
Does that make sense? If it does, how do I implement it "correctly"?
(comments are locked)
|
|
You'll want to look at the current GUI event to see which button was pressed. Try this code: Can I also add keyboard modifiers to that? (Like holding ctrl)? Well, I guess I can, but how? :P
May 18 '10 at 06:46 AM
TheMorten
if (Event.current.control) Debug.Log ("Ctrl was held");
May 18 '10 at 05:01 PM
jonas echterhoff ♦♦
Awesome, thanks!
May 19 '10 at 09:37 AM
TheMorten
(comments are locked)
|
|
Maybe sth like that? That seems to require that I create every button as a separate object in the hierarchy, and attach this script to them individually? I'm going to have 20+ buttons in the final application, so that seems a bit excessive... :/ Or am I misunderstanding this completely?
May 17 '10 at 03:18 PM
TheMorten
Why you have buttons in your hierarchy? This script creates the buttons. Just attach this to your main camera and add enough buttons into the javascript code. Or do I misunderstand sth?
May 17 '10 at 04:35 PM
Tobias
Ah, I see now... But it is still a kind of "backwards" way of doing it, compared to what I've been scripting so far. Thanks for your answer though. :)
May 18 '10 at 06:44 AM
TheMorten
(comments are locked)
|
