Example #1
0
 private void SelectGameObject()
 {
     if (GUILayout.Button(BehaviorTreeEditor.activeGameObject != null ? BehaviorTreeEditor.activeGameObject.name : "[None Selected]", EditorStyles.toolbarDropDown, GUILayout.Width(100)))
     {
         GenericMenu  toolsMenu = new GenericMenu();
         List <Brain> brains    = BehaviorTreeEditorUtility.FindInScene <Brain>();
         foreach (Brain brain in brains)
         {
             GameObject gameObject = brain.gameObject;
             toolsMenu.AddItem(new GUIContent(gameObject.name), false, delegate()
             {
                 BehaviorTreeEditor.SelectGameObject(gameObject);
             });
         }
         toolsMenu.ShowAsContext();
     }
 }
Example #2
0
 private void OnSelectionChange()
 {
     // This code is borrowed from ICode(https://www.assetstore.unity3d.com/en/#!/content/13761)
     BehaviorTreeEditor.SelectGameObject(Selection.activeGameObject);
 }