Unity Editor Toolbox
Introduction
Improve usability and clarity of key features in Unity Editor for better workflow!
This Toolbox not only extends functionalities, it does so with the user in mind. Written to be as flexible and optimized as possible. Now you and other programming professionals will be able to create a readable and useful component editor simply by using attributes. You’ll get fast and clear access to data from Game Objects placed in the Scene. Lastly, you’ll gain more control over the Project Window. Go ahead, customize those folder icons.
It's worth to mention that prepared drawers are based on the custom, layout-based system. Additionally, I’m leaving you some useful scripts, classes, and functions that facilitate Editor extensions development.
Learn all the details about the main features below.
System Requirements
Unity 2018.x or newer
Installation
- Install Editor Toolbox package:
- 1 way: Find Unity Package Manager (Window/Package Manager) and add package using this git URL:
https://github.com/arimger/Unity-Editor-Toolbox.git#upm- 2 way: Copy and paste
Editor Toolboxdirectory into your project (Assets/...)
- Open Edit/Project Settings/Editor Toolbox window
- If Toolbox Editor Settings is not available, press "Try to find the settings file" button or create new
- Manage settings in your way
- Enable/disable Hierarchy overlay, choose allowed information
- Enable/disable Project icons or/and assign own directories
- Enable/disable Toolbox drawers or/and assign custom drawers
Table Of Contents
Settings
The most important file, it allows the user to manage all available features. Can be accessed from the Project Settings window (Edit/Project Settings.../Editor Toolbox) or directly inside the Project window. Make sure to have one valid settings file per project.
Available features are divided into three groups:
- Hierarchy
- Project
- Inspector/Drawers
Each module is described in its respective section.
Attributes&Drawers
Regular Drawers
Drawers based on build-in classes PropertyDrawer/DecoratorDrawer and associated PropertyAttribute.
Editor Toolbox/Scripts/Attributes/
Editor Toolbox/Editor/Drawers/
HelpAttribute
[Help("You can provide more information in HelpBoxes.", order = 100)]
public int var1;TagSelectorAttribute
[TagSelector]
public string var1;SeparatorAttribute
ProgressBarAttribute
[ProgressBar(minValue:0.0f, maxValue:100.0f)]
public float var1 = 36.0f;NewLabelAttribute
MinMaxSliderAttribute
IndentAttribute
ConditionalShowAttribute & ConditionalHideAttribute
public bool toggle;
[ConditionalShow(nameof(toggle), true)]
public float var1;ConditionalEnableAttribute & ConditionalDisableAttribute
public bool toggle;
[ConditionalEnable(nameof(toggle), true)]
public float var1;AssetPreviewAttribute
[AssetPreview]
public GameObject var1;HideLabelAttribute
SuffixAttribute
TypeConstraintAttribute
[ClassExtends(typeof(UnityEngine.Object))]
public SerializedType type1;
[ClassImplements(typeof(System.Collections.ICollection))]
public SerializedType type2;ReadOnlyFieldAttribute
[ReadOnlyField]
public int var1;EnumFlagAttribute
[System.Flags]
public enum FlagExample
{
Nothing = 0,
Flag1 = 1,
Flag2 = 2,
Flag3 = 4,
Everything = ~0
}
[EnumFlag]
public FlagExample enumFlag = FlagExample.Flag1 | FlagExample.Flag2;[EnumFlag(EnumStyle.Button)]
public FlagExample enumFlag = FlagExample.Flag1 | FlagExample.Flag2 | FlagExample.Flag4 | FlagExample.Flag8;NotNullAttribute
RandomAttribute
DirectoryAttribute
BroadcastButtonAttribute
//NOTE1: to broadcast messages in Edit mode desired component has to have [ExecuteAlways] or [ExecuteInEditMode] attribute
//NOTE2: Unity broadcasting will invoke all matching methods on this behaviour
[BroadcastButton(nameof(MyMethod), "Click me to broadcast message", ButtonActivityType.OnEditMode, order = 100)]
public int var1;
private void MyMethod()
{
Debug.Log("MyMethod is invoked");
}InstanceButtonAttribute
SceneNameAttribute
PresetAttribute
private readonly int[] presetValues = new[] { 1, 2, 3, 4, 5 };
[Preset(nameof(presetValues))]
public int presetTarget;SearchableEnumAttribute
[SearchableEnum]
public KeyCode enumSearch;ClampAttribute
[Clamp(minValue = 1.5f, maxValue = 11.3f)]
public double var1;Vector2DirectionAttribute & Vector3DirectionAttribute
[Vector2Direction]
public Vector2 direction2d;
[Vector3Direction]
public Vector3 direction3d;PasswordAttribute
[Password]
public string password;Toolbox Drawers
Drawers are based on classes inherited from the ToolboxDrawer class and associated ToolboxAttribute. With this powerful custom system you are able to create really flexible drawers. You can use them without limitations (they work with sub-classes and as array children). Every ToolboxDrawer is layout-based. For proper work they need at least one settings file located in your project. You can find predefined one here - Editor Toolbox/EditorSettings.asset.
Editor Toolbox/Scripts/Attributes/ToolboxAttributes
Editor Toolbox/Editor/Drawers/ToolboxDrawers
ToolboxDecoratorAttributes
Display/create something before and after property in the desired order (using Order property).
In fact ToolboxDecoratorDrawers are like extended version of built-in DecoratorDrawers.
Unfortunately, standard decorators won't always work with ToolboxDrawers so try to use this replacement instead.
[BeginGroup("Group1")]
public int var1;
public int var2;
public int var3;
[EndGroup]
public int var4;[BeginHorizontal]
public int var1;
public int var2;
[EndHorizontal]
public int var3;[BeginIndent]
public int var1;
public int var2;
public int var3;
[EndIndent]
public int var4;[SpaceArea(spaceBefore = 10.0f, spaceAfter = 5.0f, Order = 1)]
public int var1;[Label("My Custom Header", skinStyle: SkinStyle.Box, Alignment = TextAnchor.MiddleCenter)]
public int var1;[Highlight(0, 1, 0)]
public int var1;[Help("Help information", Order = -1)]
public int var1;[ImageArea("https://img.itch.zone/aW1nLzE5Mjc3NzUucG5n/original/Viawjm.png", 150.0f)]
public int var1;ToolboxConditionDrawers
Enable/disable or show/hide properties using custom conditions. You can use them together with any other type of drawer. Every ToolboxConditionDrawer supports boolean, int, string and enum types and works even with array/list properties.
public string stringValue = "sho";
[EnableIf(nameof(stringValue), "show")] //or DisableIfAttribute
public int var1;public KeyCode enumValue = KeyCode.A;
[ShowIf(nameof(enumValue), KeyCode.A)] //or HideIfAttribute
public int var1;[Disable, ReorderableList]
public int[] vars1 = new [] { 1, 2, 3, 4 };InLineEditorAttribute
[InLineEditor]
public Transform var1;[InLineEditor]
public AudioClip var1;[InLineEditor(drawPreview:true)]
public Material var1;Reorderable List
Custom implementation of standard ReorderableList (UnityEditorInternal). Usable as an attribute in serialized fields or a single object in custom Editors.
Editor Toolbox/Editor/Internal/ReorderableList.cs
var list = new ReorderableList(SerializedProperty property, string elementLabel, bool draggable, bool hasHeader, bool fixedSize);[ReorderableList(ListStyle.Lined, "Item")]
public List<int> linedStyleList;[ReorderableList(ListStyle.Round)]
public List<string> standardStyleList;[ReorderableList(ListStyle.Boxed, fixedSize: true)]
public GameObject[] boxedStyleList = new GameObject[4];Editor Extensions
Hierarchy
Enable and customize the presented hierarchy overlay in the ToolboxEditorSettings. Basically it provides more data about particular GameObjects directly within the Hierarchy window. Additionally, you can create special 'Header' objects using the '#h' prefix or Create menu: GameObject/Editor Toolbox/Hierarchy Header.
Each row can contain:
- Scripts information
- Layer
- Tag
- Toggle to enable/disable GameObject
- Icon
Editor Toolbox/Editor/ToolboxEditorHierarchy.cs
Project
Set custom folder icons in the ToolboxEditorSettings.
Properties that can be edited include:
- XY position and scale of the large icon
- XY position and scale of the small icon
- Path to directory or name (depends on picked item type)
- Optional tooltip
- Large icon
- Small icon
Editor Toolbox/Editor/ToolboxEditorProject.cs
Toolbar
Editor Toolbox/Editor/ToolboxEditorToolbar.cs
Check Examples for more details.
Examples/Editor/SampleToolbar.cs
using Toolbox.Editor;
[UnityEditor.InitializeOnLoad]
public static class MyEditorUtility
{
static MyEditorUtility()
{
ToolboxEditorToolbar.OnToolbarGui += OnToolbarGui;
}
private static void OnToolbarGui()
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("1", Style.commandLeftStyle))
{
Debug.Log("1");
}
if (GUILayout.Button("2", Style.commandMidStyle))
{
Debug.Log("2");
}
if (GUILayout.Button("3", Style.commandMidStyle))
{
Debug.Log("3");
}
if (GUILayout.Button("4", Style.commandMidStyle))
{
Debug.Log("4");
}
if (GUILayout.Button("5", Style.commandRightStyle))
{
Debug.Log("5");
}
}
}Utilities
Copy and paste all components from/to particular GameObject.
Editor Extras
I decieded to move additional editors and tools to Gist.
Prefab/GameObject Painter
Check it out HERE













































