- Home /
Unity editor - sort items in any list visible in inspector
Is there a way to add method to sort items in any list in any component? Like using MenuItem, but for List instead of Component.
From comments below it looks like when you say "list", you might actually mean "array"..?
Answer by dan_wipf · Jan 14, 2019 at 12:54 PM
well what do you want to sort? this is what i had in mind. linqish solution
using System.linq;
List<Order> SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList();
Well, I want to sort everything. I mean, Unity has in-built options for "Duplicate Array Element" and "Delete Array Element" (probably driven from SerializedProperty) when you right click on list elements. But there are no options when you right click on list itself, which is quite unfortunate.
what options do you want to appear? i don’t get it right now what exactly you want
Answer by toomasio · Jan 14, 2019 at 02:09 PM
Look into reorderable lists. found another solution here: https://unitylist.com/p/rt/Unity-Reorderable-List-Utility