Im using Unity3D and character animations imported from Spine. I want to add a color overlay over those characters. For example, I have one character, I want to make it a "shadow" character, so I add the black color over it in this way:
GetComponent<SkeletonAnimation>().Skeleton.color = new Color(0f,0f,0f);
Nevertheless, I want a Tween between the regular color, and the new color. But, unfortunately, I can't do it with the DOColor method of DOTween. I try
GetComponent<SkeletonAnimation>().Skeleton.DOColor(Color.Black,1);
But the method DOColor for Skeleton doesn't exists. So which is the way to follow to accomplish this?
DoColor, DoMove, etc are shortcuts and extension method that written for unity's built-in components. SkeletonAnimation
is not supported by DoTween extension methods. You can tween its color property like this:
Color yourColor = Color.white; //GetComponent<SkeletonAnimation>().Skeleton.color
Color targetColor = Color.black;
float duration = 1f;
DOTween.To(() => yourColor, co => { yourColor = co; }, targetColor, duration);
Also, You can write your own extension:
public static class MyExtensions{
public static Tweener DOColor(this SkeletonAnimation target,
Color endValue, float duration)
{
DOTween.To(() => target.color,
co => { target.color = co; },
endValue,
duration);
}
}