- Home /
Hotkeys to move components up/down in Inspector?
Are there hotkeys to move components up and down in the inspector? I find it very time consuming to have to repeatedly right click and "move up" or "move down".
I could have sworn I saw a hotkey for this in one tutorial or another, but I can't seem to find it again. I keep finding the similar lists of hotkeys that don't seem to include it. Most of the other questions on the subject seem fairly old, and seem like they are referring to a time when one could not rearrange the order of components.
Just use $$anonymous$$oveComponentUp
and $$anonymous$$oveComponentDown
in UnityEditorInternal.ComponentUtility
Answer by xeleh · Jul 24, 2015 at 10:46 AM
Now it's possible. XT Reorder supports reordering the components in the Inspector with hotkeys.
This package has been deprecated from the Asset Store.Unfortunately, XT Reorder is no longer available.
Yes, it was deprecated because starting in Unity 5.6 you don't need an additional utility for component reordering. $$anonymous$$ore information: https://forum.unity.com/threads/deprecated-xt-reorder-drag-drop-in-the-inspector.417572/#post-3090915
Answer by kilogold · Oct 03, 2014 at 06:14 PM
As of this moment, Unity has not implemented such mechanics. There may hotkeys for other similar actions, but as for reordering the components, the closest you'll be be able to get is this:
http://u3d.as/content/man-on-edge/component-reorder/2Zb
Hope this helps!
Answer by Cobo3 · Jun 21, 2016 at 09:29 PM
This plugin does exactly that in the most possible intuitive way
Answer by RussClarke · Jul 25, 2016 at 04:14 PM
FYI although there isn't a builtin hotkey, you can add and reorder components as a multi-edit operation, which makes all the difference if you have to do this for several objects at once.
Answer by idbrii · May 17, 2018 at 05:37 PM
You can use MenuItem and the undocumented UnityEditorInternal.ComponentUtility.MoveComponentUp/Down
to make your own hotkeys.
For example to create a menu with hotkey shift-alt-u use something like:
[MenuItem("MyMenu/Component Up #&u")]
static void MoveUp()
{
var sel = Selection.activeGameObject;
var target_component = sel.GetComponent<MoveThisKindOfComponent>();
UnityEditorInternal.ComponentUtility.MoveComponentUp(target_component);
}
But as far as I know, Unity doesn't have a concept of currently selected component, so you'd have to find some way to specify which component type to move. If you made an Editor, you could have an ObjectField :
m_ComponentType = EditorGUILayout.ObjectField("Move Component:", m_ComponentType, typeof(MonoScript), allowSceneObjects: false) as MonoScript;
var target_component = sel.GetComponent(m_ComponentType.GetClass());
That editor might be a good place for your MenuItem to live.
This question only made sense when there was not built-in drag and drop reordering of components. You already exposed the reason: as there's not really a concept of currently selected component, the kind of support you can implement for this is quite limited. The best I could implement in XT Reorder was a pair of hotkeys for moving all components up or down, with a rotation of the first and last component. Not a perfect solution, but combined with the drag and drop it was good enough for many situations.
Your answer
![](https://koobas.hobune.stream/wayback/20220613125604im_/https://answers.unity.com/themes/thub/images/avi.jpg)