stdafx

Hi everyone. Can I get the slot sprite information in runtime? I want to get sprite size in each time when the animation is running.
Thanks
stdafx
Posts: 1

Nate

That's not proper use of Spine terminology. You can get the size of a RegionAttachment. Otherwise for a region or mesh attachment you can get the rendererObject, which is a game toolkit-specific object used for rendering in that game toolkit. For most game toolkits this will be an AtlasRegion which you can get size information from.
User avatar
Nate

Nate
Posts: 7538

Pharan

What do you mean by "sprite size"? Do you mean the height and width on screen?
And what do you mean by "each time when the animation is running"? Do you mean every update?

Images are called "attachments". You can access this in a slot's slot.Attachment
If it's a mesh, it's a MeshAttachment. And it only contains vertices.
You can also get world vertices from a RegionAttachment based on how its four corners are positioned by the skeleton.

You can iterate through all those vertices to find the min and max values, which can then be used to define a Rect.
User avatar
Pharan

Pharan
Posts: 4444


Return to Unity