playMaker

Author Topic: GUI navigation menu help  (Read 3709 times)

m1

  • Playmaker Newbie
  • *
  • Posts: 11
GUI navigation menu help
« on: September 20, 2011, 12:12:15 PM »
I'm creating a navigation menu for a project, using multiple GUI textures for each menu selection.  I'm trying to find an 'easy' way to change the color of the selected item, while keeping the others the original color. Since this is for a touchscreen, there will be no MouseOver states. 

I'm currently using MousePick to determine the object chosen, then sending that picked object to a Game Object Tag Switch.  This comparison sends a different transition event for each menu item chosen.  From this point, I'm not sure which way to go.  I can easily change the color of the selected item, but when I select another item, the old item is stuck at the changed color.  Is there an easy way to control this for about 10 menu items? 

I hope all that made sense.  Thanks for any help you can offer here.  Screen shot attached.
Brian

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: GUI navigation menu help
« Reply #1 on: September 20, 2011, 02:40:34 PM »
You could store the previously selected item in a variable and reset its color when you select the new item.

Alternatively, you could make a prefab button with an FSM that handles user input then use that prefab to make your menu. The prefab could have a Reset event that resets its color. You could then broadcast the Reset event when you need to reset all the buttons. In this design each button has its own FSM which may or may not be what you want...

If you're not averse to GUILayout, you could also look at GUILayoutToolbar with a custom GUISkin.

m1

  • Playmaker Newbie
  • *
  • Posts: 11
Re: GUI navigation menu help
« Reply #2 on: September 20, 2011, 02:48:29 PM »
Thanks Alex,  I'll check it out.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: GUI navigation menu help
« Reply #3 on: September 20, 2011, 02:54:09 PM »
Also check out the PlaymakerSamples/TestLab/GUIElement/3Buttons sample for an example of an FSM on a GUITexture button. It doesn't use a prefab button, but the idea is the same...

m1

  • Playmaker Newbie
  • *
  • Posts: 11
Re: GUI navigation menu help
« Reply #4 on: September 21, 2011, 01:05:58 PM »
Got it working properly. Thanks for the tip.  I used the 3 button example as a reference as you suggested. Perfect.  Thanks!
Brian