Author Topic: UIPlayTween called in code  (Read 6992 times)

Isamson

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 52
    • View Profile
UIPlayTween called in code
« on: December 06, 2013, 10:35:51 AM »
Hi Guys,

I've got a question regarding the UIPlayTween function. We are developing a game that will be both controller and mouse/keyboard controlled so I need to call most functions through code (actually uScript). So far NGUI and uScript work very well together since I have access to all functions through reflection.

So here is my situation:
I want to be able to unfold an element in a table by calling UIPlayTween through uscript. I've created myself a collision object that will trigger the UIPlayTween using a mouse click. I've added 2 UIPlayTween to this object, each linked to 2 different objects containing tweens. Clicking on the collision box will play both tweens, but calling the function in uScript only plays the top tween component.

What I'm I doing wrong here.

Running NGUI 3.0.1 (planning to upgrade to the newest version of 3.0.7 upon release)
Unity 4.5.3f
NGUI 3.7.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPlayTween called in code
« Reply #1 on: December 06, 2013, 02:15:49 PM »
Without knowing uScript I can't say much. My guess is that it's set to trigger only one function via reflection. Each UIPlayTween listens to actual events independently.

Isamson

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 52
    • View Profile
Re: UIPlayTween called in code
« Reply #2 on: December 06, 2013, 03:35:37 PM »
The way uScript works is through reflection, it transfers the function in a neat little bundle with a in/out and all available parameters. Normally, the function is simply called through this node and functions as if called from code.

I think what I mean to ask is this: If you call UIPlayTween.Play(GameObject, bool) through code, would PlayTween.Play launch all the Playtween components within that gameobject or will it only launch the top one.

Knowing this I could turn around and ask uScript devs to check where it messes up... Thanks
Unity 4.5.3f
NGUI 3.7.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPlayTween called in code
« Reply #3 on: December 07, 2013, 12:54:33 AM »
UIPlayTween.Play is not a static function, so it only has one parameter -- a boolean for 'forward'. Calling that method triggers all tweens on the object, and optionally all of the children. In both cases, 'tweenGroup' must match on the UIPlayTween and the tweens being triggered, or the tweens are ignored.

Isamson

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 52
    • View Profile
Re: UIPlayTween called in code
« Reply #4 on: December 09, 2013, 08:33:42 AM »
This seems to be a problem with the uScript Reflected node then. Thanks for the heads up.
Unity 4.5.3f
NGUI 3.7.0