I have some code that loads a TGA, like so:
AssetDatabase.ImportAsset("Assets/blah.tga", ImportAssetOptions.ForceSynchronousImport);
Texture2D textureMem = (Texture2D)Resources.LoadAssetAtPath("Assets/blah.tga", typeof(Texture2D));
I alter the texture using Texture2D.SetPixels and Texture2D.Apply as described here:
So, I want to save out the altered texture back to “Assets/blah.tga”. I’ve tried AssetDatabase.SaveAssets and have also tried to figure out how to get to the raw bytes of the TGA, but all I see available is Texture2D.EncodeToPNG - I don’t want to change the format away from TGA. Anyone know how to handle this?