Support => NGUI 3 Support => Topic started by: dlewis on November 07, 2012, 11:11:40 PM
Title: Tween delay via code
Post by: dlewis on November 07, 2012, 11:11:40 PM
I just had to modify NGUI so I could delay tweens when using TweenAlpha.Begin and thought I would share it so someone else could use it or could be added for future versions. The reason I didn't delay my calls to TweenAlpha is because the system is already in place for UITweener to delay so I wanted to leverage that.
UITweener.cs. Add the following code
// Set the delay
publicvoid SetDelay(float delay)
{
this.delay= delay;
}
publicvoid UpdateStartTime()
{
mStartTime = Time.realtimeSinceStartup+ delay;
}
UITweener.cs. Replace Start() with the following
void Start(){ UpdateStartTime(); Update();}
TweenAlpha.cs. Add a delay parameter to the Begin function