Hey. Sorry to bump this but it’s having quite the profound impact on my game\s visuals and it’s very tedious to manually change every imported texture.
You can use AssetPostprocessor and then you need feed TextureImporterPlatformSettings to the TextureImporter’s SetPlatformTextureSettings:
This example I wrote changes those bottom region box settings, naturally you could adjust majority if not every parameter in those import settings at the same time (which are also easier to change…). I also set it so that it only applies this custom import if the folder where the texture is contains word “Sprite” (capitalized.)
public class CustomImport : AssetPostprocessor
{
// From my notes:
void OnPreprocessTexture() {
// Trigger only for asset path that contains word "Sprite"
if (assetPath.Contains("Sprite")) {
TextureImporter textureImporter = (TextureImporter) assetImporter;
Debug.Log("Processing texture " + assetImporter.assetPath);
textureImporter.SetPlatformTextureSettings( new TextureImporterPlatformSettings {
maxTextureSize = 32,
resizeAlgorithm = TextureResizeAlgorithm.Mitchell,
format = TextureImporterFormat.Automatic,
textureCompression = TextureImporterCompression.CompressedHQ,
crunchedCompression = true,
compressionQuality = 75
});
textureImporter.SetPlatformTextureSettings( new TextureImporterPlatformSettings {
name = "Standalone",
overridden = true,
maxTextureSize = 32,
resizeAlgorithm = TextureResizeAlgorithm.Mitchell,
format = TextureImporterFormat.RGBA32
});
}
}
}
Important - put this to an Editor folder (anywhere is fine, just make a folder under your Scripts for example.
Otherwise the callback OnPreprocessTexture won’t fire.
If you want to change those basic settings like texture type, just do it like this: