Skip to content

Instantly share code, notes, and snippets.

@TrinketBen
Created January 14, 2016 15:11
Show Gist options
  • Save TrinketBen/2106ceec09a05ef28b53 to your computer and use it in GitHub Desktop.
Save TrinketBen/2106ceec09a05ef28b53 to your computer and use it in GitHub Desktop.
Adds options to the Component context menu (the gear) to move a component all the way to the top or bottom of the inspector.
using System;
using UnityEditor;
using UnityEngine;
public static class UtilitiesComponentContextMenu
{
[MenuItem("CONTEXT/Component/Move To Top")]
static void MoveComponentToTop(MenuCommand menuCommand)
{
var component = menuCommand.context as Component;
var moved = false;
do
{
moved = UnityEditorInternal.ComponentUtility.MoveComponentUp(component);
}
while(moved);
}
[MenuItem("CONTEXT/Component/Move To Bottom")]
static void MoveComponentToBottom(MenuCommand menuCommand)
{
var component = menuCommand.context as Component;
var moved = false;
do
{
moved = UnityEditorInternal.ComponentUtility.MoveComponentDown(component);
}
while(moved);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment