用腳本保存prefab

 1 [ExecuteInEditMode]
 2 public class WipeOutDepthPass : MonoBehaviour  {
 3 
 4     [MenuItem("Happi/wipte out all depth pass")]
 5     private static void Execute()
 6     {
 7         UIPanel[] panels = GameObject.FindObjectsOfType(typeof(UIPanel)) as UIPanel[];
 8         foreach(UIPanel panel in panels)
 9         {
10             panel.depthPass = false;
11             if(PrefabUtility.GetPrefabParent(panel) != null)
12                 PrefabUtility.ReplacePrefab(panel.gameObject, PrefabUtility.GetPrefabParent(panel),ReplacePrefabOptions.ConnectToPrefab);
13             
14         }
15         EditorApplication.SaveScene(EditorApplication.currentScene);
16     }
17 }
相關文章
相關標籤/搜索