Skip to content

Instantly share code, notes, and snippets.

@TrinketBen
TrinketBen / ComponentContextMenu.cs
Created January 10, 2024 15:44
Adds a right-click context menu item to all components that sets the Hierarchy search filter to find all components of the selected type in the scene.
using System.Reflection;
using UnityEditor;
using UnityEngine;
#if UNITY_EDITOR
namespace Trinket.StaticUtilities {
public static class ComponentContextMenu {
public enum FilterMode : int {
All,
@TrinketBen
TrinketBen / UtilitiesComponentContextMenu.cs
Created January 14, 2016 15:11
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;