Hey guys
I have written an editor script that generates a texture and then saves it to a PNG file that is immediately imported as a texture asset.
generatedTexture = GenerateSomething();
// Export as PNG file
string pngAssetPath = "Assets/Test.png";
File.WriteAllBytes(
Directory.GetCurrentDirectory() + "/" + pngAssetPath,
generatedTexture.EncodeToPNG()
);
AssetDatabase.ImportAsset(pngAssetPath);
// Assign generated texture asset to material
material.mainTexture = AssetDatabase.LoadAssetAtPath(
pngAssetPath, typeof(Texture2D)
) as Texture2D;
// But... the generated texture needs to be "Automatic Truecolor"
// in this particular scenario
How can I ensure that the texture defaults to “Automatic Truecolor” instead of “Automatic Compressed”?