public static void update() { if(frameRendered != Time.frameCount){ // make sure update is only called once per frame init(); #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 dtEstimated = Time.realtimeSinceStartup - previousRealTime; if(dtEstimated>0.2f) // a catch put in, when at the start sometimes this number can grow unrealistically large dtEstimated = 0.2f; previousRealTime = Time.realtimeSinceStartup; #else dtEstimated = dtEstimated<0f ? 0f : dtEstimated = Time.unscaledDeltaTime; // Debug.Log("Time.unscaledDeltaTime:"+Time.unscaledDeltaTime); #endif dtActual = Time.deltaTime; maxTweenReached = 0; finishedCnt = 0; // if(tweenMaxSearch>1500) // Debug.Log("tweenMaxSearch:"+tweenMaxSearch +" maxTweens:"+maxTweens); for( int i = 0; i <= tweenMaxSearch && i < maxTweens; i++){ tween = tweens[i]; // if(i==0 && tweens[i].toggle) // Debug.Log("tweens["+i+"]"+tweens[i]); if(tween.toggle){ maxTweenReached = i; if (tween.updateInternal()) { // returns true if the tween is finished with it's loop tweensFinished[finishedCnt] = i; finishedCnt++; } } } // Debug.Log("maxTweenReached:"+maxTweenReached); tweenMaxSearch = maxTweenReached; frameRendered = Time.frameCount; for(int i = 0; i < finishedCnt; i++){ j = tweensFinished[i]; tween = tweens[ j ]; // Debug.Log("removing tween:"+tween); removeTween(j); if(tween.hasExtraOnCompletes && tween.trans!=null) tween.callOnCompletes(); } } }