playMaker

Author Topic: Mutiple NGUI buttons[SOLVED]  (Read 2531 times)

santokki

  • Playmaker Newbie
  • *
  • Posts: 3
Mutiple NGUI buttons[SOLVED]
« on: April 01, 2014, 09:58:20 PM »
Let's say I have multiple NGUI buttons connected to an FSM.

How do I get the FSM to detect which NGUI button was pressed?

Thank you!
« Last Edit: April 04, 2014, 07:19:11 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mutiple NGUI buttons
« Reply #1 on: April 02, 2014, 07:21:35 AM »
Hi,

 You can't currently, instead, have one fsm per button, and then forward from that fsm an event to that fsm target. Then you will be able to trace that the even comes from a particular gameobject ( because it's been fired by an fsm, not by a script).

Use the action "get event info" to get the sender of this event.

bye,

 Jean

santokki

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Mutiple NGUI buttons
« Reply #2 on: April 02, 2014, 08:45:33 PM »
Can you be more specific when you say forward an event to another fsm ... I am new to Playmaker and I don't know what that means. Thank you!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mutiple NGUI buttons
« Reply #3 on: April 03, 2014, 07:56:39 AM »
Hi,

 no problem :)

 So, you receive "NGUI / ON CLICK" global event on a state. Use the action "send event" to send your own global event, let's say "BUTTON CLICKED", so you can send that event "BUTTON CLICKED" from different ngui controls to the same fsm.

 when in an fsm you receive "BUTTON CLICKED", you can know how sent it by using  the action "get event info" and store the "sentByGameObject".

Is it clearer?

bye

 Jean

santokki

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Mutiple NGUI buttons
« Reply #4 on: April 03, 2014, 08:27:33 PM »
Hi Jean,

I got it working by following your instructions. Thanks so much for your help!!