Skip to content

Instantly share code, notes, and snippets.

@robotron2084
Created March 1, 2016 22:13
Embed
What would you like to do?
Texture Import Settings
using UnityEngine;
using UnityEditor;
public static class ProjectMenuUtil
{
[MenuItem ("Assets/Import For PixelWave")]
public static void ImportForWave()
{
foreach(Object o in Selection.objects)
{
if(o is Texture2D)
{
string path = AssetDatabase.GetAssetPath(o);
TextureImporter importer = AssetImporter.GetAtPath(path) as TextureImporter;
importer.filterMode = FilterMode.Point;
importer.isReadable = true;
importer.textureType = TextureImporterType.Advanced;
importer.mipmapEnabled = false;
importer.textureFormat = TextureImporterFormat.AutomaticTruecolor;
importer.spriteImportMode = SpriteImportMode.None;
importer.SaveAndReimport();
}
}
}
[MenuItem ("Assets/Import For UI")]
public static void ImportForUI()
{
foreach(Object o in Selection.objects)
{
if(o is Texture2D)
{
string path = AssetDatabase.GetAssetPath(o);
TextureImporter importer = AssetImporter.GetAtPath(path) as TextureImporter;
importer.filterMode = FilterMode.Point;
importer.textureType = TextureImporterType.Advanced;
importer.mipmapEnabled = false;
importer.textureFormat = TextureImporterFormat.AutomaticTruecolor;
importer.SaveAndReimport();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment