Author Topic: How do I get full control over when a Tween starts its animation?  (Read 1929 times)

Erbacher

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 17
    • View Profile
Hi guys,

I've had a look at the documentation and other forum posts and I was shocked to see that I can not find a answer to what I thought was a simple question.

I'm looking to have full control over a Tween's animation, for example the Tween Position Component.

As it stands at the moment I am able to attach a Tween Position Component to a GameObject and when I press play in Unity the Tween animation starts automatically.
I understand I can use UIPlayTween to have some control over playing the tween again. However my main issue is that I do not want the Tween to start automatically.

So the question is, am I able to have control over when a Tween's animation plays for the first time?

If I have missed something really simple I do apologise, but can someone point me the correct direction please? :)

Thanks a lot.

xbelt

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 1
  • Posts: 9
    • View Profile
Re: How do I get full control over when a Tween starts its animation?
« Reply #1 on: March 28, 2014, 07:14:09 AM »
Just deactivate the tween in the inspector. When you want to play your tween just use
  1. gameObject.GetComponent<TweenPosition>().PlayForward();
Assuming this script is on the same gameObject to which the tween is attached

Erbacher

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: How do I get full control over when a Tween starts its animation?
« Reply #2 on: March 28, 2014, 07:28:18 AM »
Oh wow its really that simple.. I don't know how I missed that.. Thanks a lot!