Unity Pro Tip: Hierarchy Alphabetical Sort

If you are an experienced Unity user, you may have noticed that the sort order of the hierarchy window has changed in Unity 4.5, which now uses what’s called a Transform Sort. In fact, changes are even deeper than that as Unity Technologies offers now the option to customize this sort order. This can be made through editor scripts, providing each one custom sort type. First, if you want to revert to the previous behavior, add this script to an Editor folder in your Assets:

using UnityEngine;
using UnityEditor;

public class AlphaSortAlphabeticalSort { }

UnityEditor.AlphabeticalSort is a built-in class. I wonder why this sort is not available out of the box. But, that’s not the point here. Once this script is compiled by Unity, you should see a new drop-down list in the Hierarchy window, allowing you to choose the sort order you want to use. Unity - Hierarchy Alpha Sort That is only the first step in this new world of custom sort types. If you want to provide your own unique sort type, you can dive into the UnityEditor.BaseHierarchySort class documentation to learn more.