Esempio n. 1
0
 static private void ChangeGameObjectCallee(string gameObjectPath = "")
 {
     if (gameObjectPath == "~" || gameObjectPath == "")    // go to current selected game object
     {
         JumpCommand.SetCallee(Selection.activeGameObject);
     }
     else if (gameObjectPath == "/")    // go to root, always null
     {
         JumpCommand.SetCallee(null);
     }
     else if (gameObjectPath.StartsWith("/"))  // use absolut path
     {
         var foundOne = GameObject.Find(gameObjectPath);
         if (foundOne != null)
         {
             JumpCommand.SetCallee(foundOne);
         }
         else
         {
             Debug.LogError("Can not found " + gameObjectPath);
         }
     }
     else
     {
         string[] paths = gameObjectPath.Split(new char[] { '/' });
         foreach (var p in paths)
         {
             ChangeGameObjectCalleeInner(p);
         }
     }
 }
Esempio n. 2
0
 static private void ChangeGameObjectCalleeInner(string gameObjectPath = "")
 {
     if (gameObjectPath == "..")    // return to parent game object
     {
         if (JumpCommand.Callee is GameObject)
         {
             var go = JumpCommand.Callee as GameObject;
             if (go.transform.parent == null)
             {
                 JumpCommand.SetCallee(null);
             }
             else
             {
                 JumpCommand.SetCallee(go.transform.parent.gameObject);
             }
         }
     }
     else if (gameObjectPath == ".")
     {
         // do nothing
     }
     else if (gameObjectPath == "~" || gameObjectPath == "")    // go to current selected game object
     {
         JumpCommand.SetCallee(Selection.activeGameObject);
     }
     else if (gameObjectPath == "/")    // go to root, always null
     {
         JumpCommand.SetCallee(null);
     }
     else
     {
         string fullGameObjectPath = GetGameObjectFullName(JumpCommand.Callee as GameObject) + gameObjectPath;
         var    foundOne           = GameObject.Find(fullGameObjectPath);
         if (foundOne != null)
         {
             JumpCommand.SetCallee(foundOne);
         }
         else
         {
             Debug.LogError("Can not found " + gameObjectPath);
         }
     }
 }
Esempio n. 3
0
 private void OnSelectionChangedAction()
 {
     JumpCommand.SetCallee(Selection.activeGameObject);
 }