Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - dustinw

Pages: [1]
1
DOTween & DOTween Pro / Camera.DOColor slow?
« on: January 20, 2016, 10:17:05 PM »
I am trying to tween the background color of the camera, going back and forth (the method calling the below code is called every second).  Picture a puzzle game with a timer, when the timer gets low I will change the bg color on each tick until the timer reaches 0. 

On the first call it runs normally.  On subsequent calls it seems to almost ignore my duration, the color blinks really quickly.  And there seems to be a delay before it starts.  If I just call Color.Lerp on each tick it changes the color instantly, when using this sequence there is a noticeable delay before it does anything (after the first call).

Code:

//this method gets called every second
void gameTick()
    {
        UIManager.Instance.UpdateTime(gameTimer.TimeLeft);
        if (gameTimer.TimeLeft <= 5)
        {
            Debug.Log("tick");
            UIManager.Instance.BlinkTime();
            DOTween.Sequence()
                    .Append(Camera.main.DOColor(Color.black, .4f))
                    .Append(Camera.main.DOColor(new Color(255, 255, 255), .4f));
        }
    }

Pages: [1]