I'm working on an textureAtlas builder, the atlas itself is a scriptable object which holds settings and reference to source meshes and materials. I have the actual atlasTexture as a subAsset of the scriptableObject. Because of this, I don't have normal access to the normal textureImporter inspector Unity provides which allows for compression (because my atlasTexture is of type
.asset instead of a standard image format. I'm therefore trying to compress the textures via script at atlas build-time, and while the texture does get compressed (its memory footprint is significantly reduced) it becomes black.
This issue tracker seems to relate a similar problem, but I'm on 2018.4 and apparently the error isn't reproducible on that version of Unity. Here's my code.
EditorGuiUtility.CompressTexture(AtlasTexture, AtlasTexture.format, TextureCompressionQuality.Normal);