Author Topic: Tween group of gameobjects  (Read 2970 times)

giosolo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Tween group of gameobjects
« on: March 23, 2014, 12:20:36 AM »
Hi,
Using the hierarchy below, I would like to tween the colors of B,C and D with identical TweenColor values at the same time.
I understand I can use UIPlayTween script on the panel and group them all.

Panel
     NGUI Sprite  A
     NGUI Sprite  B (+TweenColor)
     NGUI Sprite  C (+TweenColor)
     NGUI Sprite  D (+TweenColor)

My questions:
1) Lets say the trigger for tweening is a click - how to script selective clicks ? (only a click during a specific state of the game should trigger the tweening)
2)  Since the tweens are identical, is there a way to use a single TweenColor that impacts several GameObjects (different hierarchy)?

Cheers,
Gio

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tween group of gameobjects
« Reply #1 on: March 23, 2014, 02:57:54 AM »
1. Don't use UIPlayTween if you need selective logic. Activate tweens yourself from your own OnClick function that will check your "if" statements within.

2. UIPlayTween can trigger many tweens that match the group of your choice if you check "Include Children". Via code you can do the same thing by doing a go.GetComponentsInChildren<UITweener>(), and then iterating through the returned list, activating the tweens.