playMaker

Author Topic: Joypad input for controlling GUI  (Read 3315 times)

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • View Profile
    • @HiFiHair
Joypad input for controlling GUI
« on: September 04, 2014, 08:56:49 AM »
Hello!

I've managed to pull together a really nice mouse-controlled user interface by making use of Unity's GUISkin object and PlayMaker's GUI actions.

However I'm having some trouble figuring out how to control the GUI using a joypad. Specifically I don't know how to swap between which button has focus based on joypad inputs.

I've been having a search of old threads without much success. Does anybody have any advice for how to achieve this?

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • View Profile
    • @HiFiHair
Re: Joypad input for controlling GUI
« Reply #1 on: September 04, 2014, 08:57:29 AM »
Heh. And no you're not allowed to just tell me to download NGUI. Although I sure am tempted.

blackant

  • Sr. Member
  • ****
  • Posts: 422
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
Re: Joypad input for controlling GUI
« Reply #2 on: September 04, 2014, 11:01:06 AM »
it's pretty simple

following this plan you can easily setup your inputs


also you can have both controls by keyboard and joypad by using same names
for exemple:
Horizontal
Type 1: Key or Mouse button
Type 2 (in a new input): Joystick Axis

same for Jump:
positive Button: space
Positive Button: joystick button 0

take care to not set any majuscule

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • View Profile
    • @HiFiHair
Re: Joypad input for controlling GUI
« Reply #3 on: September 04, 2014, 11:17:16 AM »
Heh. Thanks, blackant. Sorry, I think I should have been more specific in my original message.

I've got my inputs all set up just fine. It's the appropriate actions for changing my button states using controller input that I'm having trouble with.

By default GUI Buttons behave as expected when mouse'd over. However there's no equivalent default for joypad input. So I'm having to set up my own joypad GUI controller. I'm just not quite sure what the best approach is.

I can't find any PlayMaker actions for changing the Property of a GUI Element based on the Styles defined in the GUISkin.
« Last Edit: September 04, 2014, 11:19:27 AM by HiFiHair »

blackant

  • Sr. Member
  • ****
  • Posts: 422
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
Re: Joypad input for controlling GUI
« Reply #4 on: September 04, 2014, 01:28:54 PM »
ho , i see

personnaly i make my menu using cross pad or left stick with a wait behind each action because each input is to fast to swich menus

see the actions below
first i start out of the menu with a move detection so if the player is using the jostick, the script can begin.
on each Button:
Axis Event : Up/Down
Set (Active Label) NGUI Property Button: UIButton >State Hover
Set ( Unactive Labels) NGUI Property Button: normal
Get Button Down: Joystick A > validate this state

after that comes additional effects free to you ... (sounds, Itween and others moves)

hope this help !



JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • View Profile
    • @HiFiHair
Re: Joypad input for controlling GUI
« Reply #5 on: September 05, 2014, 05:18:31 AM »
Ah, you're using NGUI. I really need to get this.

blackant

  • Sr. Member
  • ****
  • Posts: 422
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
Re: Joypad input for controlling GUI
« Reply #6 on: September 07, 2014, 03:42:26 AM »
NGUI is a Really fast and great Help to make your GUI dynamics

You'll find a lot of possibilities using it

2D toolkit is also a good Package