- Home /
Gibt es eine Lösung/Einstellung für: Hierarchy Custom / My Sort?
Die von mir erstellte Reihenfolge der Objekte in meiner Hierarchie hat einen Grund. Ich kann damit übersichtlich und schnell arbeiten. Weshalb gibt es keine Möglichkeit das diese Reihenfolge so bleibt wie sie ist, sondern nach "irgendeinem" System umsortiert wird? Daran leidet meine Produktivität.
Im Forum finde ich leider nur Diskussionen über die Wahl zwischen Transform- und Alphanumerischer Sortierung. Dies interessiert mich jedoch gar nicht. Ich möchte einfach meine persönliche Sortierung behalten. Ich möchte jetzt oder in Zukunft nicht meine Objekte neu gruppieren oder alphanumerisch umbenennen müssen. Es kann doch nicht sein das man das so machen muss >> A_ObjektOrder, B_Cameras, C_Player, D_Events, E_Lights...
Gibt es eine Lösung/Einstellung für: Hierarchie Custom Sort? Danke!
Mod Edit: Google Translation:
The order of objects in my hierarchy created by me for a reason. I can work with it quickly and clearly. Why there is no way that this order remains as it is, but will be re-sorted according to "any" system? Because my productivity suffers.
In the forum I think, unfortunately, only discussions about the choice between Transform and alphanumeric sorting. This does not, however, interested me. I just want to keep my personal order. I want now or in the future do not need to group my new objects or rename alphanumeric. It may not be what you have to do it that way >> A_ObjektOrder, B_Cameras, C_Player, D_Events, E_Lights ...
Is there a solution / setting: Custom Sort hierarchy? Thank you!
Unfortunately, you can not modify hierarchy order from scripts as far as i know. But you may think using empty gameObject parents for categorizing, like "Walls, Enemies, SpawnPoints", and empty gameObjects named "-----------------" to simply seperate sections while developing. You can simply remove these empty objects while relasing game.
I think you can though. You have access to scene transforms in Editor scripts and you can manipulate them, like move them around , enable disabled them etc and even set their parent. So you can definitely use SetAsFirstSibling,SetAsLastSibling,SetParent,SetSiblingIndex as well. $$anonymous$$anipulations like this are used in editor scripts for Pooling solutions.
Just took a look at siblings, i'm not sure if they have something to do with hierarchy order, are you sure you can manipulate hierarchy sorting with these methods?
Answer by npatch · Oct 27, 2015 at 01:32 PM
I'm assuming you want something automatic right? If so what kind of heuristics(rules of behaviour) do you want it to have?
One possible solution would be to write an editor script to do that. You can access hierarchy data from them. Not very intuitive when you want to just write sth that works in the background but still can be done.
By having scene data available in editor scripts you can manipulate the scene itself. The sibling index is basically the child index of Transform which is the index with which is shows in the scene hierarchy, 0 being the first.(More info in the Scripting API page of Transform,check out SetSiblingIndex, SetAsFirstSibling,SetAsLastSibling etc.)
You can also see the ordering mentioned in this thread which is Editor-Script oriented: (Scripts) Useful 4.6 Scripts Collection
Your answer
Follow this Question
Related Questions
Get all items from hierarchy? 2 Answers
Editor Window with settings and Asset Creation 1 Answer
Some changes in hierarcy gone after i run play mode ? 0 Answers
Custom Editor: show asset folders in ObjectField 2 Answers
Extending an editor control 0 Answers