Author Topic: Tween Delay problem  (Read 3036 times)

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Tween Delay problem
« on: June 04, 2013, 04:49:42 AM »
Normal i would use the following code to start the tween.
  1. weenTransform TweenTwo = TweenTransform.Begin(this.gameObject,3f,animationAncorTwo);
The problem is that if i start the tween this way i can use the delay:
  1. TweenTwo.delay = 5f;

I tried to create the tween fist and start it later, like this:

  1. TweenTransform TweenTwo = new TweenTransform();
  2. TweenTwo.delay = 5f;
  3. TweenTwo.Play(true);
But i get errors...

  1. NullReferenceException
  2. UITweener.Play (Boolean forward) (at Assets/NGUI/Scripts/Tweening/UITweener.cs:283)
  3. HandDemo.SteppTwo () (at Assets/GUI/Scripts/HandDemo.cs:38)
  4. UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
  5. UITweener:Update() (at Assets/NGUI/Scripts/Tweening/UITweener.cs:188)
  6.  

What the correct way to use the delay ?


EDIT: If found out how:

  1. TweenTransform TweenTwo = this.gameObject.AddComponent<TweenTransform>();
  2. TweenTwo.delay = 5f;
  3. TweenTwo.Play(true);
  4.  
Using the keyword new was not a nice idea :)
« Last Edit: June 04, 2013, 05:05:49 AM by Malzbier »