using System.Collections;
using UnityEditor;
using System.Collections.Generic;
public class SpriteFunction : EditorWindow{
static void Init() {
SpriteFunction winodws = (SpriteFunction)EditorWindow.GetWindow(typeof(SpriteFunction),true, "sprite 方法");
winodws.Show();
}
TextureImporter getTextureSetting(string path) {
TextureImporter importes = AssetImporter.GetAtPath(path) as TextureImporter;
// 貼圖設定功能
return importes;
}
void loopSetTexture() {
Object[] textures = getSelectTexture2D();
Selection.objects = new Object[0];
foreach (Texture2D texture in textures) {
string path = AssetDatabase.GetAssetPath(texture);
TextureImporter texImporter = getTextureSetting(path);
TextureImporterSettings tis = new TextureImporterSettings();
texImporter.ReadTextureSettings(tis);
texImporter.SetTextureSettings(tis);
AssetDatabase.ImportAsset(path);
}
}
/// <summary>
/// 選取貼圖
/// </summary>
/// <returns></returns>
Object[] getSelectTexture2D() {
return Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets);
}
}
沒有留言:
張貼留言