• Unity
  • How do I set the size of Skeleton Graphics? (UI)

Related Discussions
...

We have just started using Spine in our project, and have successfully imported our animated character.

But how can I control the size it is shown at in the UI with a Skeleton Graphic? Changing the scale of the Skeleton Data can make the character globally bigger or smaller, but what if I want the UI element to be 150 pizels?

It's a simple UI task, but i haven't found a way to do it yet. Thanks for any help you can offer.

You can use the RectTransform's 'Scale' parameter or the Scale Tool (as opposed to the RectTool) to scale the graphics. The RectTransform's Width and Height values do not affect the actual scale of the sprite (since it is also not bound to those borders).

Is there a way to find out the dimensions of the skeleton graphic? Then I could do some calculations to scale it to the right size. This is important because if I can't explicitly set the size of it in some way, then the size depends on the player's screen resolution instead of on our design.

If this isn't supported by the Skeleton Graphic component then how am I supposed to use it? How is it normally used if not to create UI components?

Note a skeleton doesn't really have a single size. It is animated, so its axis aligned bounding box (AABB) can change depending on the animation. SkeletonData width and SkeletonData height tell you the AABB of the setup pose, which can be used for scaling purposes. Skeleton getBounds can be used to get the AABB for a skeleton's current pose.

Thanks. I'll try using those.