public static bool AssetSetFormat(string path, TextureImporterFormat format)
{
if (string.IsNullOrEmpty(path))
return false;
TextureImporter ti = AssetImporter.GetAtPath(path) as TextureImporter;
if (ti == null)
return false;
TextureImporterSettings settings = new TextureImporterSettings();
ti.ReadTextureSettings(settings);
settings.textureFormat = format;
ti.SetTextureSettings(settings);
SPTools.DoAssetReimport(path, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport);
return true;
}