Author Topic: Starting a TweenColor event?  (Read 9145 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Starting a TweenColor event?
« on: May 28, 2012, 07:09:02 AM »
Not sure how to use this function. I have my gfx ready to apply my color tween, not exactly what the Event Receiver means. I basically just want to start().

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Starting a TweenColor event?
« Reply #1 on: May 28, 2012, 08:15:02 AM »
Ok I have some more progress. But as soon as the game starts it pingpongs automatically forever. All I want to do is .PlayOnce whenever I call it. For some reason this seems quite a bit more complicated that the UiButton Color feature. I really am getting quite stuck.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Starting a TweenColor event?
« Reply #2 on: May 28, 2012, 12:46:00 PM »
UIButtonColor isn't a tween, it just triggers tweens. TweenColor, on the other hand, is an actual tween, so they behave differently. Triggering via code, you would use TweenColor.Begin. Via inspector? Add the tween color, set it to play forward.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Starting a TweenColor event?
« Reply #3 on: May 28, 2012, 08:17:11 PM »
Well, I don't understand it all. If I enable the TweenColor in the inspector it just plays automatically and forever as soon as the program starts, I have no control over it at all.

TweenColor.Begin doesn't work for me, I have no idea where to call it. And I have my TweenColor attached to a UILabel and TweenColor.Begin requires a GameObject. So I am stuck with a Tweencolor that either never starts or just plays uncontrollably.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Starting a TweenColor event?
« Reply #4 on: May 28, 2012, 08:21:16 PM »
I basically want to do this:-

- Drag and drop the TweenColor script to an object inside my Menu Hierachy

- Do something like this:-

if (blah == true)
{
TweenColor.Begin(TheMenu.GetComponentsInChildren<UISprite>()[0], 1.2, Color.yellow); //
}


or

if (blah == true)
{
TheMenu.GetComponentsInChildren<TweenColor>()[0].begin(); // As all set in the script already
}

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Starting a TweenColor event?
« Reply #5 on: May 28, 2012, 10:40:31 PM »
Well, I don't understand it all. If I enable the TweenColor in the inspector it just plays automatically and forever as soon as the program starts, I have no control over it at all.

o_O? Sure you do. Just disable the script.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Starting a TweenColor event?
« Reply #6 on: May 29, 2012, 01:00:03 AM »
Ok so when I disable it, if I call the Begin function, it will just enable it for a single play?

Still not quite sure how to do that though since I get a compile error as it is expecting a GameObject and not a UILabel.
Will have to take another look I think.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Starting a TweenColor event?
« Reply #7 on: May 29, 2012, 01:39:09 AM »
That's how it works, yeah. Note the second example, it does just that.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Starting a TweenColor event?
« Reply #8 on: May 29, 2012, 02:28:56 AM »
Absolutely haven't got a single clue.

I can't choose a component, so I put the whole menu gameobject in and something that doesn't have the script attached randomly turns yellow, and after calling it only once in the code, the whole thing stays yellow forever. It does not play once.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Starting a TweenColor event?
« Reply #9 on: May 29, 2012, 03:57:56 AM »
o_O?

You can separate tweens into groups if you have more than one tween on the same object. Also make sure that the include children checkbox isn't checked.