We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e6b3657 commit beef940Copy full SHA for beef940
1 file changed
Assets/Scripts/Editor/Hierarchy/UnparentMe.cs
@@ -0,0 +1,21 @@
1
+// unparents selected gameobject in hierarchy (by moving to grandparents if available)
2
+
3
+using UnityEditor;
4
5
+namespace UnityLibrary
6
+{
7
+ public class UnparentMe
8
+ {
9
+ // https://docs.unity3d.com/ScriptReference/MenuItem.html
10
+ // shift U shortcut key
11
+ [MenuItem("GameObject/Unparent #u")]
12
+ static void UnParent()
13
14
+ // TODO: add undo
15
+ if (Selection.activeGameObject != null && Selection.activeGameObject.transform.parent != null)
16
17
+ Selection.activeGameObject.transform.parent = Selection.activeGameObject.transform.parent.parent;
18
+ }
19
20
21
+}
0 commit comments