Author Topic: Disable Item via script after few seconds and reset Tweener  (Read 2597 times)

alexsan99

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Disable Item via script after few seconds and reset Tweener
« on: August 14, 2014, 10:53:41 AM »
 I'm trying to make this effect in my game using NGUI:
-Player clicks a Button (buy something or trade)
-Panel is activated and Label/message shows up -> popup
-Panel has two Tweens attached: position and alpha

This works fine when I use such approach for popup windows, where there is a 'Close button' inside window that resets Tweens and disables Panel/Item. 'Close button' has "UIButtonActivate" script attached.

But I cannot make it work in similar way without button/Onclick event: I'm trying to disable Item and reset Tweens via script.
I need to deactivate and reset everything after a few seconds via script, otherwise Tweens are not repeating, of course.

What is the right way to do that?
wondering if there is a solution similar to UIButtonActivate script, but without onClick? after Tweening is done
« Last Edit: August 14, 2014, 04:05:26 PM by alexsan99 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disable Item via script after few seconds and reset Tweener
« Reply #1 on: August 15, 2014, 07:30:46 AM »
Tweens can have an OnFinished notification set. You can call a function that starts a coroutine inside that waits X seconds then does something.