|
I want to try out GetButton. Just so happens that I have a button, but I don't know the name, is it "Hole in One!"? If not, how is a name give to a button. Thanks!
(comments are locked)
|
|
Input.GetButton (which is what I believe you're referring to) is used for physical inputs (mice, keyboards, joypads). The "virtual" button described in the docs is the named button assigned to a physical input in the Input Manager. You "read" GUI buttons as Cyclops pointed out in this answer. It is possible, however, to name a GUI button using GUI.SetNextControlName if that's what you're really after, although this approach is primarily used to manage GUI focus and not to make some action happen when a GUI button is pressed. @burnumd good point, I hadn't thought about the GetButton() function, based on his code sample, but that certainly could be what he meant...
May 05 '10 at 08:07 PM
Cyclops
Yeah, I think your answer gets at what the OP is actually trying to do (if I read the question correctly), just thought I'd provide an obscene number of links in case it's not. :)
May 05 '10 at 08:25 PM
burnumd
Dang, but that's a lotta links... the Gui, half a dozen controls, my name, the other answer in the thread... sheesh. :)
May 05 '10 at 08:31 PM
Cyclops
Yup, Input.GetButton was what I was getting at. It's cool that you can name a GUI button. Thanks for all the links :) I'll start taking a look.
May 06 '10 at 12:59 PM
rd42
(comments are locked)
|
|
The way you would use a Button is:
It doesn't really have a name, rather you create it and check if it was pressed - then do some code if it was pressed. Read over the GUI Scripting Guide for more help on how to use the GUI.
(comments are locked)
|
|
hi guys. I just found that threat, by searching in google for the buttons names. I think R Delano, asked you how he can access a button, that was created by script. For example if we have: What will happen if, few lines below i want to make that Button, inactive, so the player can't click it. Can i access the Button's enable property? This way i can put it to 0 or 1... I found that there is a GUI.enabled class variable, but how i can make it to be exactly for the button, i want it to be? Cuz i might have 10 buttons.... If the buttons have something like a system names, that we can use to reach their properties, etc...
(comments are locked)
|
