using UnityEngine;
using UnityEditor;
public class TextureSet : ScriptableObject
{
[MenuItem("CMD/CompressTextureTo64 &C")]
static void ChangeTextureSize_32() {
SelectedChangeMaxTextureSize();
}
// static void CangeAnim(){
// //SelectedChangeMaxTextureSize(32);
// //Object con = GetSelectedCon ();
// }
static void SelectedChangeMaxTextureSize() {
Object[] textures = GetSelectedTextures();
Selection.objects = new Object[0];
foreach (Texture2D texture in textures) {
string path = AssetDatabase.GetAssetPath(texture);
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
textureImporter.textureType=TextureImporterType.Sprite;
textureImporter.maxTextureSize = 64;
AssetDatabase.ImportAsset(path);
}
}
static Object[] GetSelectedTextures()
{
return Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets);
}
static Object[] GetSelectedCon()
{
return Selection.GetFiltered(typeof(AnimatorOverrideController), SelectionMode.DeepAssets);
}
}
09-06