fix bug with reimport of texture

This commit is contained in:
aliaksei.kalosha
2025-04-12 01:40:06 +02:00
parent 09404e6e06
commit 87dcb1024f
3 changed files with 27 additions and 7 deletions

View File

@@ -342,16 +342,24 @@ namespace SplashEdit.RuntimeCode
}
string assetPath = AssetDatabase.GetAssetPath(texture);
var tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
bool needReimport = false;
if (tImporter != null)
{
if (tImporter.maxTextureSize > MaxTextureSize)
{
tImporter.maxTextureSize = MaxTextureSize;
needReimport = true;
}
if (tImporter.isReadable != isReadable)
{
tImporter.isReadable = isReadable;
needReimport = true;
}
if (needReimport)
{
AssetDatabase.ImportAsset(assetPath);
AssetDatabase.Refresh();
}
tImporter.isReadable = isReadable;
AssetDatabase.ImportAsset(assetPath);
AssetDatabase.Refresh();
}
}
}