calvin-tl

I have a reference to a SkeletonGraphic and I'm setting the alpha like this:
skeletonGraphic.Skeleton.a = 0f;
This is based off Pharan's advice in this thread:

http://esotericsoftware.com/forum/Unity-Can-I-control-opacity-2338

Unfortunately, the alpha remains at whatever the Skeleton Graphic's "Color" property is in the editor.

When I debug that line, I can verify that the value does change, but at some point later that frame it is getting reset to the editor value.

Our Spine Runtime is Version 3.6.xx but we're receiving Spine Animations exported with Spine Editor 3.7.xx. We are releasing a new build soon so there is some hesitation to upgrade our runtime, but if that were the reason this isn't working, I could make an argument for it.

Thanks for any help!
calvin-tl
  • Posts: 10

Harald

Importing assets exported from Spine 3.7 in the 3.6 Runtime will not work as desired. You can sometimes be lucky that things still seem to look correct, but nevertheless you are walking through a minefield where things can break anytime.

So we strongly that you either export the assets with the 3.6 Spine editor or switch to the 3.7 runtime.

There is a runtime upgrade guide on the forum:
Spine-Unity 3.6 to 3.7 Upgrade Guide
User avatar
Harald

Harri
  • Posts: 327

calvin-tl

Thanks for your reply Harald. That was my concern, so I think we'll work around it for now. Thanks for the link, too - that'll be very helpful when I can upgrade our runtime next week. :)
calvin-tl
  • Posts: 10

Harald

Great to hear, glad you decided to upgrade the runtime!
User avatar
Harald

Harri
  • Posts: 327

calvin-tl

Alright, we're all upgraded to 3.7 and still running into this issue.

I'm debugging an isolated scenario and I can see both 'A' and 'a' changing to the intended values, but by next frame they seem to reset again.

Any more help is greatly appreciated!
calvin-tl
  • Posts: 10

Harald

Sorry for the inconvenience - I just noticed that in case of SkeletonGraphic you have to set the skeletonGraphic.color property, which overrides the skeletonGraphic.Skeleton.color every frame. So the proper way would be:
skeletonGraphic = GetComponent<Spine.Unity.SkeletonGraphic>();
float alpha = 0.5f;
var oldColor = skeletonGraphic.color;
skeletonGraphic.color = new Color(oldColor.r, oldColor.g, oldColor.b, alpha);
User avatar
Harald

Harri
  • Posts: 327

calvin-tl

Worked like a charm! Thanks for your help. :)
calvin-tl
  • Posts: 10

Harald

Great to hear, thanks for letting us know! :)
User avatar
Harald

Harri
  • Posts: 327


Return to Unity