niezhijing

Hello, I have some questions and hope to get your answers.
I am implementing the dressing through GetRemappedClone and Skin.SetAttachment, but I found that when I did this, a lot of uncompressed texture resources were added to SceneMemory, which took up a lot of memory space. Excuse me, what can I do for this part of the texture? Can it be compressed?
niezhijing
  • Postovi: 14

Harald

In general, please note that if you use GetRemappedClone with a Sprite as input, then it depends on the bool premultiplyAlpha parameter whether a Texture copy will be created or if the copy can be avoided at all (see this line here):
// <param name="premultiplyAlpha">If <c>true</c>, a premultiply alpha clone of the original texture will be created.</param>

So perhaps the best way would be to avoid unnecessary texture copies in the first place by using straight alpha attachment clones from Unity Sprites.

If you still want to use compression, copying to and from compressed textures is limited by the general design of compression formats, requiring any copy regions being aligned with multiples of 4x4 texel blocks. I have just added two optional parameters to the GetRemappedClone method that let you specify the texture format of the newly created PMA texture and whether it shall have mipmaps enabled. It's added in this commit on the 4.1-beta branch. A new 4.1-beta spine-unity package is available for download here as usual:
Spine Unity Download: Download
Avatar
Harald

Harri
  • Postovi: 4101


Natrag na Unity