@hiknapolitano We have this issue ticket here to support custom slot materials for SkeletonGraphic as well, unfortunately we didn't get to implement this yet:
EsotericSoftware/spine-runtimes1982
hiknapolitano

- 10 août 2023
- Inscrit 16 mars 2023
hiknapolitano There are alternative ways, but they involve more programming work on your side. I assume you only need the images to be generated within the Unity Editor and not at runtime, so the easiest way would be to just let your Editor script change the Texture Importer's compression setting temporarily to
None
, pack the skin to your texture, and then reset compression to the previous value again.- Modifié
Hi and welcome to Spine!
Do you want to display the complete atlas texture as you see it in the Project panel? If so, then you can use normal means to either change the
Texture Type
in the Texture Importer settings toSprite (2D and UI)
and set theSprite Mode
to e.g.Single
. Then you can assign the sprite at aSpriteRenderer
as usual. Please note that by default, Spine will pack your Attachments to atlas pages independently from which Skin they are used by. So you could have e.g. five skins and all attachments fit on two atlas pages.If you don't need it to be a
Sprite
specifically, you can also assign the Material for the desired atlas texture page at a Quad object. Note however that the size of the quad will not be adjusted automatically if it's a non-square atlas texture (like 512x256).If you want to iterate over all atlas pages (not only actively used pages, which you could get via
meshRenderer.Materials
), you can use the following code:AtlasAssetBase[] atlasAssets = skeletonAnimation.SkeletonDataAsset.atlasAssets; for (int i = 0; i < atlasAssets.Length; ++i) { foreach (Material material in atlasAssets[i].Materials) { if (material.mainTexture != null) { // assign material.mainTexture at your desired object } } }
You could either change the texture at an existing
Sprite
(which is used at yourSpriteRenderer
) or create a newSprite
from the given atlas texture.If you want to only show attachments that are currently active (attachments of a specific single skin) and want to display them layed out in a grid or line next to each other, I'm afraid this will involve some coding on your side. If that's what you want, please let us know, then we can provide some information on how you could achieve that.