diff --git a/Assets/Plugins/GoKit/GoTween.cs b/Assets/Plugins/GoKit/GoTween.cs index bd3b1be..9a8fe92 100644 --- a/Assets/Plugins/GoKit/GoTween.cs +++ b/Assets/Plugins/GoKit/GoTween.cs @@ -44,13 +44,22 @@ public GoEaseType easeType /// public AnimationCurve easeCurve { get; set; } - /// - /// initializes a new instance and sets up the details according to the config parameter - /// - public GoTween( object target, float duration, GoTweenConfig config, Action onComplete = null ) - { - // default to removing on complete - autoRemoveOnComplete = true; + /// + /// initializes a new instance and sets up the details according to the config parameter + /// + public GoTween( object target, float duration, GoTweenConfig config, Action onComplete = null ) + { + // all tweens must be intialized to have a duration greater than zero. keep in mind that this will ensure + // the tween occurs over two frames: the initialized value, and the final value. if you are looking for a + // tween to reach the end of it's tween immediately, be sure to call complete() on it after creation. + if( duration <= 0 ) + { + duration = float.Epsilon; + Debug.LogError( "tween duration must be greater than 0. coerced to float.Epsilon." ); + } + + // default to removing on complete + autoRemoveOnComplete = true; // allow events by default allowEvents = true;