user-interfaceunity-game-enginecross-fade

CrossFadeColor not working from dark to white


This i do not understand, and I don't know how to make this work...

I am trying to make a panel image color fade from a dark green to white like this:

myPanel.GetComponent<image>().CrossFadeColor (colorToFadeTo, fadeTime, true, true);

This do not work... It seems like it keeps the base color (green) and then puts the other color into that color :-/

Can anyone help me with this... Any help is appreciated.


Solution

  • I can't find much information on CrossFadeColor, but I do know it would work as you expect with Color.Lerp since it will change the color, not add it.

    You will have to do it in a coroutine, or the Update.