用脚本保存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 }

 

posted @ 2013-06-25 10:21  Marble  阅读(3580)  评论(0编辑  收藏  举报