If you want to change the color of the whole skeleton, use SkeletonAnimation
's skeleton
.
The Skeleton
class has r
, g
, b
and a
fields. you can change at run time.
Note that the Skeleton
object is a Spine-C# class and not a Spine-Unity class so it has no knowledge of the UnityEngine.Color
type.
So you can/need to change those fields individually.
r, g, b and a are just plain float fields. They normally take values between 0f to 1f.
For example:
To make the skeleton 50% opaque, your code could say:
Spine.Skeleton skeleton = GetComponent<SkeletonAnimation>().skeleton;
skeleton.a = 0.5f;
This doesn't need to be done every Update().
Note that fading out a whole character comprised of many parts using this will still fade out the parts individually. So depending on the style, things may look weird at 50% opacity. Try it out to see what I mean.