• Bugs
  • GetRepackedSkin returns broken texture when using custom Tex

  • Изменено
Related Discussions
...

Hello everyone

I am using the GetRepackedSkin method to repackage skins at runtime. Our game is aimed at mobile platforms and we need to use TextureFormat to reduce the size of the textures.

When I use GetRepackedSkin on textures with a custom TextureFormat, I end up with a broken texture. I did a little investigation and there is a result:

  1. When I pass a skin with a TextureFormat.PVRTC_RGBA4 to GetRepackedSkin, an exception appears in the console:

    Graphics.CopyTexture can only copy memory with the same size (src=24128 bytes dst=3016 bytes), maybe the size (src=232 * 208 dst=29 * 26) or format (src=RGBA Compressed PVRTC 4BPP UNorm dst=RGBA8 UNorm) are not compatible

  2. When I pass a skin with a TextureFormat.PVRTC_RGBA4 to GetRepackedSkin and set textureFormat parameter to TextureFormat.PVRTC_RGBA4 I get a broken texture:

I also saw that the resulting texture does not have the TextureFormat that I was passing. I will be glad for any help.

Best regards,
Vitaly

You cannot use texture compression with repacking unfortunately. This is also documented in the list of common causes for repacking to fail on the spine-unity docs pages here (section Runtime Repacking, Important Note). Please always have a look at these documentation pages first.