Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: dustinw on January 20, 2016, 10:17:05 PM

Title: Camera.DOColor slow?
Post by: dustinw 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));
        }
    }
Title: Re: Camera.DOColor slow?
Post by: dustinw on January 21, 2016, 12:05:37 AM
Another strange issue, if I set the color from default (in my case white) to say new Color(255, 167, 167), it ignores my color.  If I say Color.black (for example) then it uses the color.

Camera.main.DOColor(Color.black, .4f) //will use color

Camera.main.DOColor(new Color(255, 167, 167), .4f) //ignores color, doesn't do anything

(latest Unity, 5.3x)