- Home /
Duplicate Question
Controlling GUI with Xbox 360 Controller
Hi all,
I've hit a bit of a predicament in the process of making my game. For the moment I would like to focus on making a really decent split-screen game before I think about online multiplayer, especially as certain aspects of my game require testing with an opposiing player.
I'm going to use two Xbox 360 controllers, since these are commonplace and I can't simply plug in two sets of mice and keyboards and expect it to work- if there is some way I can than do this, this would be preferable to a controller! This is because my game has button-controlled GUI elements essential to gameplay. Can anyone suggest the code I would use to access the buttons on a GUI using such an controller?
For example, if I had such a code:
void OnGUI() {
if(GUI.Button(new Rect(x,y,h,w), "Some Function")){
//Do Something Here
}
if(GUI.Button(new Rect(x,y+k,h,w), "Some Other Function")){
//Do Something Else Here
}
}
How would I modify this to select the button using to the controller thumbpad and press the button with 'A' rather than by cursor and mouse click?
Cheers,
Popuppirate