Unsupported texture format - needs to be ARGB32, RGBA32, RGB24, Alpha8 or one of float formats
This is the error I get when I try to encode something to png or jpg using EncodeToPNG or EncodeToJPG Functions. I was working with one of my old libraries from Unity 5.0. I see that textureImporter.textureFormat is deprecated so how could I encode a asset png/jpg without setting the format.
You now have to create an instance of TextureImporterPlatformSettings and set the format on it (along with other fields, including the platform) then call textureImporter.SetPlatformTextureSettings passing in the settings.