Skip to content

Instantly share code, notes, and snippets.

@kxn4t
Created March 16, 2024 07:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kxn4t/9e9b24a1cd0cbad290f63710742ce1a4 to your computer and use it in GitHub Desktop.
Save kxn4t/9e9b24a1cd0cbad290f63710742ce1a4 to your computer and use it in GitHub Desktop.
UnityでAsset import時にCrunch圧縮のみを強制的に解除してimportするEditor拡張
using UnityEditor;
namespace kxn4t.gist
{
internal class DisableCrunchCompressionPreprocessor : AssetPostprocessor
{
private void OnPreprocessTexture()
{
TextureImporter textureImporter = (TextureImporter)assetImporter;
var settings = textureImporter.GetDefaultPlatformTextureSettings();
if (settings.crunchedCompression)
{
settings.crunchedCompression = false;
textureImporter.SetPlatformTextureSettings(settings);
UnityEngine.Debug.Log(textureImporter.assetPath + ": Crunch compression was forced disabled!");
}
}
}
}
@kxn4t
Copy link
Author

kxn4t commented Mar 16, 2024

おそらくUnity2022の場合、導入時になぜか既存のテクスチャに対しても処理が走ってしまうようなので、全部切りたいときにも使える…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment