Author Topic: When UIEvent Trigger's [On Deselect] called?  (Read 2770 times)

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
When UIEvent Trigger's [On Deselect] called?
« on: August 15, 2014, 03:04:06 AM »
What I want is, I have 6 UIButtons, if I touch one of them, its tween color start ping pong and shows its now selected.

And if I touch another button, previous button's tween color effect should be turn off and new touched button's tween color effect should start.

So I added UIEventTrigger and set tween color sprite to 'On Select'.

But I don't know how to stop this when click another button.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: When UIEvent Trigger's [On Deselect] called?
« Reply #1 on: August 15, 2014, 07:45:34 AM »
You can just examine that short script's code to answer this question.
  1.         void OnSelect (bool selected)
  2.         {
  3.                 if (current != null) return;
  4.                 current = this;
  5.                 if (selected) EventDelegate.Execute(onSelect);
  6.                 else EventDelegate.Execute(onDeselect);
  7.                 current = null;
  8.         }