Skip to content

Instantly share code, notes, and snippets.

@umiyuki
Created April 19, 2015 09:52
Show Gist options
  • Save umiyuki/e8ef0c3501c288a58823 to your computer and use it in GitHub Desktop.
Save umiyuki/e8ef0c3501c288a58823 to your computer and use it in GitHub Desktop.
Unity3DでProjectビューで選択したフォルダ以下の2DテクスチャのGenerateMipmapsを全部外すエディタ拡張
using UnityEngine;
using UnityEditor;
public class ChangeTextureImportSettings : MonoBehaviour {
[MenuItem("Custom/Texture/CheckOffGenerateMipmaps")]
static void CheckOffGenerateMipmaps()
{
Object[] textures = Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets | SelectionMode.Assets);
foreach (Texture2D texture in textures)
{
string path = AssetDatabase.GetAssetPath(texture);
TextureImporter texImporter = AssetImporter.GetAtPath(path) as TextureImporter;
if (texImporter.mipmapEnabled)
{
texImporter.mipmapEnabled = false;
AssetDatabase.ImportAsset(path);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment