Asunto: Spine Attachment Color changed at Unity' Runtime
Aesop a écritHello!,
I've tried to find info about this topic and read the API but I don't understand how could and should change an attachment's color. I know the slot color is the way to go, but I use the slot color for another purpose.
In the current project I'm using a Skeleton Mecanim. And I got it working by doing this:
[SerializeField] private SkeletonMecanim _skelAnim; [SerializeField] private Spine.RegionAttachment[] bladeAttachments = new Spine.RegionAttachment[28]; [SerializeField] private Color bootColor; private void Start() { bladeAttachments[0] = (Spine.RegionAttachment)_skelAnim.skeleton.GetAttachment("Blade_R_Side_Boot", "Blade_R_Side_Boot_1"); bladeAttachments[1] = (Spine.RegionAttachment)_skelAnim.skeleton.GetAttachment("Blade_L_Side_Boot", "Blade_L_Side_Boot_1"); } void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { bladeAttachments[0].SetColor(bootColor); bladeAttachments[1].SetColor(bootColor); } }
Even though it works, I still want to know the best practices!
Thanks for your attention!