Beispiel #1
0
 protected override List <Component> FindComponentsByTypeName(string typeName)
 {
     return(GameObjectUtil.FindComponentsOfType(typeName, false));
 }
Beispiel #2
0
 protected override void UpdateObjectsList()
 {
     sceneRoots = GameObjectUtil.FindAllGameObjects();
 }
Beispiel #3
0
 protected override List <GameObject> FindGameObjectByName(string name)
 {
     return(GameObjectUtil.FindGameObjectsByName(name, false));
 }
Beispiel #4
0
 protected virtual List <Component> FindComponentsByTypeName(string typeName)
 {
     return(GameObjectUtil.FindComponentsOfType(typeName, true));
 }
Beispiel #5
0
 protected virtual List <GameObject> FindGameObjectByName(string name)
 {
     return(GameObjectUtil.FindGameObjectsByName(name, true));
 }
Beispiel #6
0
 protected virtual void UpdateObjectsList()
 {
     sceneRoots = GameObjectUtil.FindSceneRoots();
 }
        void DrawFindGameObjectPanel()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("GameObject.Find");
            findGameObjectFilter = GUILayout.TextField(findGameObjectFilter, GUILayout.Width(256));

            if (findGameObjectFilter.Trim().Length == 0)
            {
                GUI.enabled = false;
            }

            if (GUILayout.Button("Find"))
            {
                ClearExpanded();
                var go = GameObject.Find(findGameObjectFilter.Trim());
                if (go != null)
                {
                    sceneRoots.Clear();
                    state.expandedGameObjects.Add(new ReferenceChain().Add(go), true);
                    sceneRoots.Add(go, true);
                    sceneTreeScrollPosition = Vector2.zero;
                    searchDisplayString     = String.Format("Showing results for GameObject.Find(\"{0}\")", findGameObjectFilter);
                }
            }

            if (GUILayout.Button("Reset"))
            {
                ClearExpanded();
                sceneRoots = GameObjectUtil.FindSceneRoots();
                sceneTreeScrollPosition = Vector2.zero;
                searchDisplayString     = "";
            }

            GUI.enabled = true;

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("GameObject.FindObjectsOfType");
            findObjectTypeFilter = GUILayout.TextField(findObjectTypeFilter, GUILayout.Width(256));

            if (findObjectTypeFilter.Trim().Length == 0)
            {
                GUI.enabled = false;
            }

            if (GUILayout.Button("Find"))
            {
                var gameObjects = GameObjectUtil.FindComponentsOfType(findObjectTypeFilter.Trim());

                sceneRoots.Clear();
                foreach (var item in gameObjects)
                {
                    ClearExpanded();
                    state.expandedGameObjects.Add(new ReferenceChain().Add(item.Key), true);
                    if (gameObjects.Count == 1)
                    {
                        state.expandedComponents.Add(new ReferenceChain().Add(item.Key).Add(item.Value), true);
                    }
                    sceneRoots.Add(item.Key, true);
                    sceneTreeScrollPosition = Vector2.zero;
                    searchDisplayString     = String.Format("Showing results for GameObject.FindObjectsOfType({0})", findObjectTypeFilter);
                }
            }

            if (GUILayout.Button("Reset"))
            {
                ClearExpanded();
                sceneRoots = GameObjectUtil.FindSceneRoots();
                sceneTreeScrollPosition = Vector2.zero;
                searchDisplayString     = "";
            }

            GUI.enabled = true;

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
 public void Refresh()
 {
     sceneRoots = GameObjectUtil.FindSceneRoots();
     TypeUtil.ClearTypeCache();
 }