Пример #1
0
 //====================================
 // Prefaber
 //====================================
 public void DrawPrefaber()
 {
     GUILayout.BeginHorizontal("box");
     EditorGUILayout.LabelField("Prefab", GUILayout.Width(60));
     if (GUILayout.Button("Revert", GUILayout.Width(100)))
     {
         ProxyEditor.RegisterSceneUndo(this, "Revert Selected Prefabs");
         foreach (GameObject current in Selection.gameObjects)
         {
             ProxyEditor.ReconnectToLastPrefab(current);
         }
     }
     if (GUILayout.Button("Apply", GUILayout.Width(100)))
     {
         ProxyEditor.RegisterSceneUndo(this, "Apply Selected Prefabs");
         foreach (GameObject current in Selection.gameObjects)
         {
             GameObject root = ProxyEditor.GetPrefabRoot(current);
             ProxyEditor.ApplyPrefab(root, ProxyEditor.GetPrefab(root));
         }
     }
     if (GUILayout.Button("Detach", GUILayout.Width(100)))
     {
         ProxyEditor.RegisterSceneUndo(this, "Apply Selected Prefabs");
         foreach (GameObject current in Selection.gameObjects)
         {
             ProxyEditor.DisconnectPrefabInstance(current);
         }
     }
     GUILayout.EndHorizontal();
 }