void DrawShowButton()
 {
     GUI.color = Color.yellow;
     if (GUILayout.Button("Show"))
     {
         Undo.RegisterCompleteObjectUndo(_target, "Show DisplayObject");
         _target.SetActive(true);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Solo this DisplayObject within other DisplayObjects at the same level in the hierarchy.
 /// </summary>
 public void Solo()
 {
     if (transform.parent != null)
     {
         foreach (Transform item in transform.parent)
         {
             if (item == transform)
             {
                 continue;
             }
             DisplayObject displayObject = item.GetComponent <DisplayObject> ();
             if (displayObject != null)
             {
                 displayObject.SetActive(false);
             }
         }
         gameObject.SetActive(true);
     }
     else
     {
         foreach (var item in Resources.FindObjectsOfTypeAll <DisplayObject> ())
         {
             if (item.transform.parent == null)
             {
                 if (item == this)
                 {
                     item.SetActive(true);
                 }
                 else
                 {
                     item.SetActive(false);
                 }
             }
         }
     }
 }