- Home /
How do I alphabetise the hierarchy after Scene Manager was implemented?
Hey guys,
When I use the hierarchy I like to be able to alphabetise it so I can quickly move items around in the scene. This functionality was removed in Unity 5, but I fixed it using the following code:
using UnityEngine; using UnityEditor;
public class AlphabetiseHierarchy : BaseHierarchySort {
public override int Compare(GameObject lhs, GameObject rhs)
{
if (lhs == rhs) return 0;
if (lhs == null) return -1;
if (rhs == null) return 1;
return EditorUtility.NaturalCompare(lhs.name, rhs.name);
}
}
However, I've now updated to 5.4 and the dropdown menu that used to exist no longer exists.
How can I alphabetise my hierarchy now? This adds masses of time onto very simple operations, and it's incredibly frustrating.
Cheers.
Answer by AlexRoseGames · Feb 11, 2017 at 07:00 PM
No one seems to have any answer to this, am I to assume there is no answer?
Right now I'm thinking of writing a sorter class that executes in edit mode on gizmosdraw, and finds all game objects whose parent == null and who don't have component X attached, then attach component X, which stores their current sibling index in the list.
Then write another class that always lives at the top of the scene which also executes on edit mode, and has an enum which, when changed, sorts the list by their old sibling index or by alphabetical index depending on what you want.
This seems like a really stupidly elaborate solution for something that should be simple, is there really no way to do this anymore?
No one else is replying so I guess this is the best answer.
Your answer
Follow this Question
Related Questions
My Player Gameobject is missing on hierarchy during the play mode 1 Answer
Hierarchy Class 0 Answers
How can i make things visible again 3 Answers
RotateAround in local coordinates? 1 Answer