- Home /
AssetPostprocessor, AssetImporter set spritePackingTag invalid, Can't change texture meta.
i use AssetPostprocessor AssetImporter like this: inherit AssetPostprocessor, and use OnPostprocessAllAssets funtion.
private static void PresetUITexture(AssetImporter assetImporter, string atlasName, string assetName)
{
TextureImporter textureImporter = (TextureImporter)assetImporter;
if (textureImporter == null)
{
return;
}
textureImporter.mipmapEnabled = false;
textureImporter.spritePackingTag = atlasName;
textureImporter.textureFormat = TextureImporterFormat.AutomaticCompressed;
}
i use reimport option to reimport my textures. e.g: i want set the packing tag "UI_ITEM" to my all textures. it will work in unity editor, i can see the packing tag changed in editor window.
But i find the texture meta not changed.
before: after:
So if i close unity editor at now, texture import settings will be rest. the packing tag "UI_ITEM" will be lost....
Then i found, if i reimport all texures twice. texture metas will be changed in the second reimport .
Your answer
Follow this Question
Related Questions
Only PostProcess/PreProcess on new assets 1 Answer
change textures without changing the original file 0 Answers
Unity 5.6 not importing some .psd files correctly 0 Answers
AssetDatabase.ImportAsset fails on generated textures 1 Answer
Texture importer script: How to avoid resetting value when make changes 0 Answers