Author Topic: bug, Tweener OnFinished being deleted at runtime  (Read 7271 times)

arkon3

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 71
    • View Profile
bug, Tweener OnFinished being deleted at runtime
« on: March 26, 2014, 12:00:25 AM »
I have a strange bug. I have a game object with a TweenPosition on it. When the tween finishes I want it to call a function so I create the function and add it to the OnFinished Notify method. The object has a collider on it and I use UIButtonMessage to call a function when I press the object. That function activates the tween on the object. The teen happens about 50% of the time but occasionally I get an exception (null pointer in UITweener) when I look at the onFinished component on the tweenposition the method has gone! its just an empty box.

I use this method on many other buttons with no problem, but just this one goes wrong. any ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: bug, Tweener OnFinished being deleted at runtime
« Reply #1 on: March 26, 2014, 02:58:34 AM »
Why are you using UIButtonMessage? It's a legacy component that should not be used anymore. UIEventTrigger fully replaces it. Events don't get deleted with the current latest version of NGUI unless you add them with the 'true' flag for 'oneShot'.