批量解压模型格式!
using UnityEngine;
using UnityEditor;
namespace SK.Framework
{
public class ModelImportSettings : EditorWindow
{
private ModelImporterMaterialLocation location;
[MenuItem("SKFramework/Tools/Model Import Settings")]
private static void Open()
{
GetWindow<ModelImportSettings>("Model Import Settings").Show();
}
private void OnGUI()
{
GUILayout.BeginHorizontal();
{
GUILayout.Label("Location");
location = (ModelImporterMaterialLocation)EditorGUILayout.EnumPopup(location);
}
GUILayout.EndHorizontal();
if (Selection.gameObjects.Length == 0) return;
GUILayout.FlexibleSpace();
if (GUILayout.Button("Apply"))
{
for (int i = 0; i < Selection.gameObjects.Length; i++)
{
var obj = Selection.gameObjects[i];
string path = AssetDatabase.GetAssetPath(obj);
ModelImporter importer = AssetImporter.GetAtPath(path) as ModelImporter;
if (importer != null)
{
importer.materialLocation = location;
}
}
}
}
private void OnSelectionChange()
{
Repaint();
}
}
}