Last active
August 20, 2020 02:10
-
-
Save liveasnotes/1e086f9eb6d3c017760d9181d730ba45 to your computer and use it in GitHub Desktop.
VR4PE_20200223
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // (c) 2019 liveasnotes | |
| // https://gist.github.com/liveasnotes/1e086f9eb6d3c017760d9181d730ba45 | |
| using UnityEditor; | |
| using UnityEngine; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| /// <summary> | |
| /// ヒエラルキーウィンドウで、選択したオブジェクト(複数選択可)の直上の親オブジェクトを選択できるスクリプト | |
| /// <summary> | |
| public static class SelectDirectParents | |
| { | |
| [MenuItem("Edit/Select Direct Parents %&z")] | |
| private static void SelectParents() | |
| { | |
| if (Selection.activeGameObject) | |
| { | |
| List<GameObject> targetParents = new List<GameObject>(); | |
| foreach (GameObject childrenObj in Selection.objects) | |
| { | |
| targetParents.Add(childrenObj.transform.parent.gameObject); | |
| } | |
| Selection.objects = targetParents.ToArray(); | |
| }; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment