Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 4.5 New Hierarchy Window sorting

Discussion in 'Editor & General Support' started by Ben-BearFish, May 27, 2014.

  1. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    I don't understand this sorting - Why is it if I manually order objects in the hierarchy, pressing Play in the editor will automatically move things around and once I stop it doesn't go back to what I had? Is this a bug or expected behavior?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't see that behavior. If I put stuff in a certain order, it stays like that.

    --Eric
     
  3. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    I'm only noticing it in one particular scene - strange. Oh well.

    EDIT: Ok, I've figured it out - definitely a bug it seems? The manual sorting works as expected except when I have objects that are cloned via Instantiate(). I have some pooling stuff happening and as soon as the gameObjects are created and are added to the hierarchy, it permanently completely screws up my ordering.

    Can anyone verify this? Or am I just doing something wrong/misunderstanding? Thanks.
     
    Last edited: Jun 5, 2014
  4. MetaZhi

    MetaZhi

    Joined:
    Feb 18, 2013
    Posts:
    28
    What's annoying most is that when I Ctrl+D, the new object appears in the bottom of the whole list other than appearing next to the object being duplicated.
     
  5. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Current implementation IS inconsistent. The order has different behavior based on the object type (i.e. sorting the drawing order of GUI vs. "normal" game objects like cubes where it does not affect the z-ordering..). The idea of some special container for GUI object is actually very good. Why you have to mess up the functionality of the whole Hierarchy view just to get the new GUI sorting to work? Expecting lots of problems when doing things dynamically from script...
     
  6. aresgameshk

    aresgameshk

    Joined:
    May 19, 2014
    Posts:
    32
    I have already submitted a bug report.
    It doesn't matter if you have alphabetical sorting or not.
    As long as you have an active hierarchy window open with a very large scene, the editor will freeze up whenever the hierarchy window tries to refresh, which happens every time you click on an asset in the project window, or if you change object hierarchy during runtime

    In a new project, just create a scene with 10K+ empty game objects. Open a few hierarchy windows. Click on any asset in project window and your editor WILL freeze for minutes.

    The moment you close or "hide" the hierarchy windows by adding a different tab over it, the problem will disappear.
     
  7. lredsp

    lredsp

    Joined:
    Apr 24, 2014
    Posts:
    1
    Yup, the same thing happens to me. Have you submitted a bug report?
     
  8. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    Not yet - wanted to verify if this was happening to anyone else or if it was just me doing something wrong. Good to know.
     
  9. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    Your description "permanently completely screws up my ordering" is a bit vague. I've tried to reproduce your problem, but can't. Creating many random child/parentless objects didn't effect my current order at all.

    It appears that all newly instantiated (non-child) objects are placed at the very top of the scene hierarchy. While any instantiated child objects are placed at the very end of the parent's hierarchy. I suspect that your "bug" is in the object pooling system code itself. Is it messing with the parent/child transform relationships?

    Any newly added/duplicated object created in the editor is automatically placed at the end of the scene or parent hierarchy. This is probably by design to ensure that the existing order of things is not tampered with. Having a manual alphanumeric sorting option like the one I suggested earlier could help with this issue.

    It also seems like an in-depth article on the blog about the actual functionality and reasoning behind the changes to Unity's sorting system could be quite beneficial to the community and perhaps help clear up some of the confusion and frustration.
     
    Last edited: Jun 5, 2014
  10. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226

    Please submit a bug ASAP as PM me a bug # when you get one and i'll get this fixed as fast as I can.


    As a note we are taking your comments into consideration when it comes to alphanumerical not being a option any other way than via adding a script and we've come up with a solution. Cant give more details as of yet as it was only done yesterday and we need more internal input about implementation.
     
    luispedrofonseca and IsaiahKelly like this.
  11. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    I'm not sure i understand the "no sort" option. The version that is the default is the "no sort" option. It is displaying the data exactly how it is being stored.
     
  12. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    I have a similar problem, but it happens in a different way.

    I have a prefab with 9 children, ordered in a certain way.

    I add a new child in this prefab transform.parent = prefab.

    Then when I click on Play, all the transforms are randomly moved, and when I come back to the editor mode they keep their strange order.


    Another bug:
    - I use the script to set the transform alphabetically. It works in the editor.
    In a Start function, I get all the children of the prefab and put them in an array.

    When I read the array, the children are in a random order (as described above), while in the hierarchy they are in the alphabetical order...
     
    Last edited: Jun 6, 2014
  13. kocherovets.d

    kocherovets.d

    Joined:
    Mar 5, 2014
    Posts:
    10
    Can I get list of game objects exactly as in hierarchy window?

    A
    ---B
    ---C
    ------D
    E
    F
    ---G


    as

    ABCDEFG


    I have not very big 2d scenes and want to automatically set Order in Layer by hierarchy order.
     
  14. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    As a FYI just because they are alphabetical order in the hierarchy doesn't mean the data is stored alphabetically. The visualization of data has nothing to do with how the data is stored and it is ALWAYS stored in the order you see if you have the "transform order" sort selected.

    As for the bug where transforms are randomly moved, although i've heard other people mention this I have not been able to reproduce it. If you could submit a but then PM me the bug number.
     
  15. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226

    So I'm assuming that you are taking about getting the order based upon the current sorting method and not just the default order. If so then at the moment no the information if not exposed in anyway. There are a couple reasons for this.

    1) The data structure that the hierarchy data is stored in is currently internal. This is because it is part of a subsystem that hasn't been made public. If this ever does go public then we might be able to expose it.

    2) The way the hierarchy works is it only get the items that are currently expanded. This means that its a incomplete data set for your purposes. Using your example if A was collapsed instead of expanded the hierarchy would only return "AEFG"

    3) You'd also need to know which hierarchy window you wanted to drive the Order in Layer from as there could be multiple hierarchy windows open all with different sorting methods active.

    What you are talking where 2D would take advantage of the manual ordering i *think* we are considering for a future release but no idea when it will come true.
     
  16. kocherovets.d

    kocherovets.d

    Joined:
    Mar 5, 2014
    Posts:
    10
    Thanks. Please add in future releases Unity Editor API method for getting hierarchy tree by sorting method. Hierarchy is a valuable part of development and it will be usefull to have its structure.
     
  17. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    It's buggy.
    I reorder my game object, hit play, and the hirarchy reset.
    So there is no way for me right now to get my old hierachy and to be able to use the new GUI system when it will be out.
    I had game object name: Map1_, Map2_ etc.. Now it's Map1,Map3,Map12 etc..
    The reorder is not saved. So nice buggy feature. Did you test it ?

    > a) Its often better to deliver one consistent 'way of doing things', than special case objects in the same list, having this > two ways to order inside the list, users would have to actively think about which areas of his hierarchy are reorderable > and the ones that aren't.

    Typical Prog mistake: try to manage a particular case (GUI) into generic (object hierachie).
    There is no improvement into the hirarchy. Now you can't find object by following the alphabetical order anymore...

    You could have:
    - Add another way to order GUI Layer (flag, tag, editor etc..).
    - Handle 2D gui in a particular way inside the hierarchy of your canvas children (adding a layer icon/color etc..)
    Both solution are better.

    Also one big mistake:
    - When we "import" our project with the Unity 4.5, the alphanumiracal should have been kept. And if the user want to reorder he can.
    I don't see any reason why the migration messed with the hierarchy and force us to reorder everything like it used to be.

    But one good thing:
    - You can add your own script to reorder objects.
     
  18. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    Yes, I discovered this fact when I was doing some testing with the new & old hierarchy views. It explained a strange problem I had before: When adding child objects to an array in code they always seemed to be stored in a random order completely different from what I saw in the hierarchy. I now realize that this was because the hierarchy view I was seeing before was not the true order of the children at all!

    Being able to see the real order now is a big improvement, but letting users use both the fake/real sort views is only asking for big problems. I think the only real solution would be to remove the fake sort view completely and replace it with a real alphanumeric sort option. You wouldn't necessarily need to expose the feature in code. Just let users perform an alphanumerical sort in the editor on command.


    I've tried to reproduce this random sorting bug with no luck. Could you upload an example project or script of the problem for me to test out (after you submit the bug). I don't understand why the order would remain messed up after exiting play mode. Are you modifying prefabs at runtime?
     
    Last edited: Jun 7, 2014
  19. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    Is the object a prefab? If you reorder children inside a prefab and don't apply the changes to the prefab. It will revert back to it's default state upon entering play mode.

    So it turns out that the old alphanumeric sorting view was only a "visual" thing like Phil said earlier. Meaning you weren't actually seeing the real hierarchy at all! This is why your upgraded projects look like a mess. You now get to see the ugly truth! :eek:

    I do agree that they should have had some kind of feature in place to correct this issue when upgrading projects, but maybe it was too hard to implement yet. However, I'm sure they will come up with a good solution to fix this.
     
    Last edited: Jun 7, 2014
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nope, it stays where you put it; that's what transform order means. It doesn't get re-sorted, since there is no other criteria to be sorted by.

    --Eric
     
  21. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    The naming is somewhat misleading. "Transform Sort" shows how everything is actually organized. "Alphanumeric Sort" only changes the way the hierarchy is displayed, but doesn't actually sort anything. If you try moving objects around and then switching between the two sort modes you'll see this.
     
  22. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    So hitting "play" mess your prefab? That's a bug, don't you think? "Play" shouldn't change anything in your project.
    The order of the game object in the prefab should be like any informations, you can override it for your instance.
    Yes that's a little complicate to handle, but that's how it has to be done if you want to keep Unity "clean".

    The hierachy view is a view to facilitate user navigation. I really don't care what's behind it and I shouldn't.
    That's how you need to think when you work on a user interface.
    You can let the user reorder object. But only when he wants it...

    They should at least give us a script that reorder game object permanently (and not only in the view). So we can get our project like they used to be.
     
  23. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    I am adding some transform inside the prefab in a Start function, with transform.parent = prefab.

    I will try tu submit the bug.

    By the way, when doing "transform.parent = prefab", is it possible to chose the position of the transform? Can we change the order of transforms at runtime by script?
     
  24. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Yes bugs help the most as some of these things are project dependent.

    And yes you can set the position via script. On the transform there are 4 helper functions. SetAsFirstSibling, SetAsLastSibling, SetSiblingIndex(index) and GetSiblingIndex. I think they are all pretty self explanatory but if not let me know and i can explain them 1 by 1.
     
  25. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Yes that is a bug, it should maintain position. And in fact does for my test projects. Please submit a bug.

    I agree when working with a user interface the user should have to care about what's behind the scene. Yes there was a visual change which we provided a way to display the data how it originally was. Yes there were some minor backend changes but i'm not 100% sure in what sort of cases you'd need the data represented alphabetically. Either way i dont think that thats a script we'd provide but if you feel so strongly about it as i've said in my last post there are 4 helper functions you can use to order the object via a script upon entering play mode.
     
  26. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    You're right. I guess I never thought of it as a bug because It's just restoring the prefab to it's original state, but it shouldn't do that and this will cause a lot of problems.

    I completely agree with everything you said here. I was only trying to explain why the upgrade seemed to mess up your project, but your right in that users shouldn't need to care about the "why". They just want to use it the way they expect to use it.
     
  27. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    You don't see why you need to display things in Alphabitical order. Is it a joke ?
    How your system file manager works ? Why is it working like that ?
    One other big reason: it's because Unity was working that way for many years. People have organize their project with this constraint. Sometime you need to change things and you can't convert everything. But that's not the case here :)

    Couldn't you keep the old order when doing the conversion from 4.3 to 4.5 ?

    Let's imagine that I use your script to reorder of how game objects are displayed. But imagine that at the same time I want to modify the order of the GUI layer -> possible or not ?
    It's going to be a problem that you will have with every script that reorder game object hierarchy. I'm not sure you had think about that.

    View order and layer position are correlate, but you want people to use script to change the display order like if it was not correlate. It's not going to work :) But maybe I made a mistake (I didn't tryied the GUI..)

    And I'm not telling that you should keep the old system how it was. I say that you should have done the conversion better.
     
  28. metinevren

    metinevren

    Joined:
    May 17, 2014
    Posts:
    28
    This ... thing is driving me crazy. I have to search for my objects evert time I want to select them. No I do not want to sort their order by hand every time I add an object. Also moving their order is such a pain in the ass. It's a challenge on its own. God forbid if you dont aim for the right pixel now you have a bunch of objects become child of another. Is this going to be fixed or not?
     
  29. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    No i do see why you need to display things in ALphabetical order which is why we provided a script and we are working on a built in "solution". But its just that how things are displayed not how they are stored. I read your comment as you wanted the data stored in alphabetical order. It is the storage in alphabetical order that will not happen by us (i dont think).

    We see the project browser and hierarchy as different. The project browser heavily mimics the OS in terms of ordering where the hierarchy mimics more of the 3rd party tools (maya, photoshop) in terms of not being alphabetical ordered.

    When i left the hierarchy it was maintaining the order for everything. I then got moved back to focusing on the GUI and i'm guessing some upgrade process was corrupted if its not keeping the order upon first import. Could you possibly file a bug. I know its a PITA but i'm so busy with uGUI i dont want to forget about these "little" things.

    I think we are talking about different things to a degree. The new hierarchy just changes the visual order of the objects (if a sort method is chosen) not the data storage. But you are right if you start changing the order via a script then it would effect how uGUI renders are is uses the hierarchy order to determine render order.


    Have you for now implemented the script that will resort the items to alphabetical order (was posted earlier in this thread as well as is on the Unity Docs)? That also reverts the dragging and dropping logic back to how it was before (not able to drop an item in between other objects).

    By "fixing" it if you mean are we going to find a way to have the alphabetical ordering built in instead of forcing a script to be added? Yes. If by "fixing" you mean improved the drag and drop experience? Yes. If by "fixing" you mean change how the data is stored? No the data will not be stored as alphabetical.
     
    rakkarage likes this.
  30. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    Thank you phil for your answer. I don't know if I will have time to fill a bug report (I shouldn't write on this forum right now..)
    I, of course, don't say to store the data alphabetical forever by using some type of container :)
    Just a script that reorder them when a user ask for it.

    You are free of not being fond of the alphabetical order, but that's very convinient for most people.
    That's why file manager use this convention and that's probably why previous Unity version use this convention.
     
    Last edited: Jun 7, 2014
  31. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    I am making an editor extension right now that will allow users to permanently sort the hierarchy alphanumerically. I'll post it here ASAP. Please stand by...
     
  32. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    Okay here it is. I'm calling it the "Hierarchy Organizer". You can download it over here on the new forum topic.
     
    Last edited: Jun 15, 2014
    rakkarage and id0 like this.
  33. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Very Cool, if you cared you could likely also work it into the context menu of the hierarchy (although thats a little more work). Great initiative though.
     
    IsaiahKelly likes this.
  34. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    I submitted a bug: 612637

    There is no script in the projects, just a few transform inside a parent prefab. When hitting Play, the transforms in the parent gets reordered, and remain like this when quitting.
    I have 3 transforms in the parent: 2 "normal" ones and a prefab. If I put the prefab as the first child, then it becomes the last one when hitting Play. If I put it at any other position (aka not the first one), then it's fine.

    I hope you will manage to reproduce it with my project.
     
  35. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    Interesting... It appears that this random resorting bug is related to the prefab override bug.
     
  36. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    Great thank you.
     
  37. kocherovets.d

    kocherovets.d

    Joined:
    Mar 5, 2014
    Posts:
    10
    Hi!

    I have done this task in current Unity version. Script must be a sort of:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEditor;
    4.  
    5. public class SortOrderClass : Editor
    6. {
    7.     [MenuItem ("Quest/Resort sprites")]
    8.     static void SortOrder ()
    9.     {
    10.         EditorApplication.hierarchyWindowChanged += SortOrderCallback;
    11.         SortOrderCallback();
    12.     }
    13.  
    14.     static void SortOrderCallback ()
    15.     {
    16.         SpriteRenderer[] all = GameObject.Find("Stage").GetComponentsInChildren<SpriteRenderer>(true);
    17.         int value = 0;
    18.      
    19.         for(int i=0; i<all.Length;){
    20.             SpriteRenderer sr = all[i];
    21.          
    22.             SpriteController sc = sr.gameObject.GetComponent<SpriteController>();
    23.          
    24.             if(sc.renderAfterChilds){
    25.                 int count = i+1;
    26.                 while(count<all.Length){
    27.                     if(!all[count].transform.IsChildOf(sr.transform)){
    28.                         break;
    29.                     }
    30.                     ++count;
    31.                 }
    32.                 sr.sortingOrder = value + (count - i - 1)*100;
    33.                 ++i;
    34.             }else{
    35.                 sr.sortingOrder = value;
    36.                 value += 100;
    37.                 ++i;
    38.             }
    39.          
    40.             EditorUtility.SetDirty(sr);
    41.         }
    42.      
    43.         SceneView.RepaintAll();
    44.     }
    45. }
     
  38. snlehton

    snlehton

    Joined:
    Jun 11, 2010
    Posts:
    99
    I'm cool with this as long as it would work and there would be a way to sort the scene or parts of it reliably (ie. no perf hit crashes or anything).

    If you have prefab instances in the scene, the sorting goes wonky when loading. It's broken. Also the fact that you need to implement a editor script to get alphabetical sorting for the hierarchy is just insanely stupid.

    I would be so awesome if Unity would bother to properly test these kind of fundamental changes before releasing them in the wild.
     
    Last edited: Jun 10, 2014
  39. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Well between the time implementation was finished and 4.5 was release something got changed that affected how the hierarchy and prefabs worked. Noone from Dev's to QA to beta testers caught this issue so it happened to slip by unnoticed. We are working on getting a fix implemented asap.
     
  40. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Something useful at last ! Thank you! Thank you very much! The new hierarchy is crap, I can't find a thing.
     
    Last edited: Jun 12, 2014
  41. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    I have not grabbed 4.5 yet but I love this update as @leo.carneiro mentioned , it's consistent with how most other software display lists work .. index based with manual drag and drop change support!

    but Im sad to hear about the performance bug @Ares Games reported , this is enough for me not to download 4.5
     
  42. chargedneuron

    chargedneuron

    Joined:
    Jan 12, 2013
    Posts:
    21
    a) Then based on that comment of "being consistent" I would suggest a component<GUI_Object> that is attached to a GameObject that can be moved up and move down the list like other GameObjects with components. That gives the expected function of being alpha sort with the ability to layer sort GUI items.

    GameObject_MainMenu
    - component<GUI_Object> Titlebar
    - component<GUI_Object> Play Game
    - component<GUI_Object> Options
    - component<GUI_Object> Credits

    GameObject_GameHUD
    - component<GUI_Object> Points
    - component<GUI_Object> Lives
    - component<GUI_Object> Radar
    - component<GUI_Object> Options

    where moving component<GUI_Object> up and down changed its GUI.Index based on its location in the Component array index.

    That is how myself personally would see changing the sort order to accommodate your new GUI (which I admit to not having seen yet) as being consistent to other interfaces in Unity Editor.

    b) /crickets

    c) Transform sort keeps changing in my project regardless of how I manually sort things. So I have given up manually sorting things every session; added a script to alpha sort and when I have to address the new GUI system I will end up manually indexing the GameObjects as "~10", "~20", "~30". I waste more time locating objects in the "Random" Transform Sort "feature" than getting work done.

    Thank you for your consideration.
     
    Last edited: Jun 15, 2014
  43. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    How is this "being consistent"? You are talking about creating "special case objects" with a system that was not designed for it. You can't make an object a "component" of itself or another, that isn't what components are for. This is completely inconsistent with the way Unity works.

    If you want to manually sort objects you have to do so by transform. Creating another special system just for sorting GUI elements sounds like a very bad idea to me. What happens when you want to manually sort something other then a GUI object?
     
    Last edited: Jun 16, 2014
  44. chargedneuron

    chargedneuron

    Joined:
    Jan 12, 2013
    Posts:
    21
    Educate me, I'd like to learn something; why would I want to make a "GameObject" into a "Component"? Perhaps my comment was a bit vague. If this whole sorting issue is to accommodate GUI Objects, why can't they be (new flavor of) GUI Components rather than GameObjects? Then I could enable/disable whole GUI systems by enable/disable their GameObject? Not unlike what we (I) do to enable/disable the Scripts on said GameObjects. As most of my GUI scripts reuse the same variables over and over (Actually I use a custom class, but that's besides the point).

    Second question so I might learn something today; Why would I care what order transforms are in (other than GUI layers)?

    Regardless of how it ends up being done in the end my issues are/were;
    a) Manual sorting doesn't stay put. It changes between session to session and from "Play" to "Stop". Just when you think you know where to find something (especially if you spent the time to manually sort things [repeatedly]) they shift about. (as already mentioned)
    b) With Transform-Sort finding things is very time consuming; relative to alphabetically. (see comment A). (Network debugging is fun enough without breaking train-of-thought to locate something that starts with 'A' and can't be found; where I put it, where it should be, where it might be, or near the top of the hierarchy... /Squirrel!
    c) The upgrade process should have left things where they were rather than jumping out there and screaming "Surprise!". From there, they could continue as Transform Sort if they must. (as you stated above)

    I get that most people are resistant to change - I like to consider myself relatively flexible. Unity's Transform-Sort has consumed my time with locating objects rather than debugging my (network) code. In short, so-far a not so "useful" but time-consuming feature (subject to change). And as this is a 'hobby' and not my day job, I am far too engaged in this conversation for only intending to offer an opinion/suggestion.

    Thank you for your time ---
     
    Last edited: Jun 16, 2014
  45. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,638
    They actually are component-based, but it's not practical to put hundreds of GUI components (for every image, bit of text, bit of interaction, etc) on a single object, and it would mean all of the existing tools for positioning/rotating/scaling objects would be completely unusable for GUI.

    You can - you can set the root GameObject in a GUI to be inactive, and then all its child objects (and associated components) will be disabled too.

    There's a number of things you could do with this:
    • If you're dynamically instantiating things, then transform order is effectively instantiation order - newly instantiated objects get added to the end of their parent's list. This can be very helpful when debugging.
    • Suppose you're building a patrol AI. You place a transform at each patrol point. Then you could use transform order to configure the order in which the points should be visited.
    • You now have the ability to refer to GameObjects in a way that is consistent across game sessions (unlike InstanceID) and that has no problems with uniqueness (unlike object names). This can be useful for things like load/save.
    This is an out-and-out bug, I think.
    I actually agree with you that 4.5 should have shipped with alphabetical sort out-of-the-box, and that projects upgrading to 4.5 should have turned it on by default. This got brought up during the beta, but the team - for whatever reasons - disagreed.
     
    IsaiahKelly likes this.
  46. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    This is a fairly big deal. I (and apparently others), would really....really like UT to take another peak at an integrated alpha sort option. On behave myself and the others caught off guard with this 'feature'...for the love of God, if you are going to change something so base and expected in the software, perhaps someone could float the proposed change publicly first instead of steamrolling it through? Good or bad, useful or just annoying, this was a significant change to workflow. Springing this 'feature' on your user base(even if some think it's better than sliced bread), then telling us to live with it seems...arrogant and dismissive.
     
  47. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,638
    Well, they've already said that they are looking at what they can change.
     
  48. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    418
    This is going somewhat off-topic, but I'll try to help explain.

    I think you meant to say "why wouldn't I want to make an object a component?" Objects have components, but components are not objects. You can create a component (script) that references an object(s), but the component itself is not an object. This is an important point to remember. Components are only used to define what an object is and how it functions.

    A component is just a part of an object and if you look at the new GUI system, you will see that each GUI object has GUI components attached to it. So GUI elements are components already, but they have to be attached to an object! This is because you need to have a way to group multiple components for a single GUI element together.

    You can also disable objects just like components. So you already can enable/disable whole GUI systems this way.

    It's very useful when you want to keep something at a particular position in the hierarchy, Like a game manager object, etc.. Actually, the whole point of manual sorting is to make things stay where they are. It sounds like you're experiencing the bug that's randomly changing sort order on play mode. I also agree that there should of been a way to preserve the original sort order when upgrading to 4.5.

    I'm sorry to hear that. I think automatic alphabetical sorting is great for a lot of things, but not always a good thing. I'm sure unity will come up with a good compromise for this.

    Have you tried my Hierarchy Organizer tool? It should help you some.

    Edit: Thanks Superpig! You beat me to it and probably addressed chargedneuron's questions better then me.
     
    Last edited: Jun 16, 2014
    rakkarage likes this.
  49. chargedneuron

    chargedneuron

    Joined:
    Jan 12, 2013
    Posts:
    21
    I thank you both for the detailed explanations.

    I will have to think deeper on this; with my programming style I have no use for Transform-Sort (at this point) - other than for GUI Elements (regardless of their actual form) which I already control via my Window Manager Script Component. (I fully understand the difference between GameObject and an attached Component, but I thank you for the explanation all the same.)

    A large part of my Network based game calls for Prefabs to be instantiated; my "Spawners" assign their instantiated objects as children (for internal logic reasons). I am certain that the use of these Prefabs is what is scrambling my Hierarchy when I use Transform-Sort.

    Isaiah Kelly; I use the Editor Script near the top of this thread "AlphaNumberSort.cs" - (Credit to StarManta for pointing it out on page 1) Thank you for also providing a stop-gap solution.

    My NPCs use a Script Component to not only monitor their waypoints but also their "isThinkingAbout" values (in short, none of my waypoints would ever be just a Transform without a Waypoint Script Component attached, which also handles sorting). They sort themselves out on Awake() and locate the waypoint nearest to the NPC regardless of where the NPC is relative to the waypoint chain. So no need for a Transform-Sort there; but I understand your example.

    I will think more on your examples but I'm not sold on the Transform-Sort idea yet - the scramble bug isn't helping either.

    I apologize for continuing to grind this topic, and I thank your and applaud you for your efforts.

    (PS - As I look at my Hierarchy behind this window, it has ignored the Alpha-Sort and scrambled again... Back to work.)
     
  50. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    934
    This thing is a huge mess! It feels like it was one of those new "features" that got zero testing and was rushed out of the door. Can't believe that such a fundamental thing was so overlooked.

    In my projects I have no idea what's going on with the hierarchy... Sometimes objects appear to sort alphabetically, sometimes I position them manually and next thing I know everything is mixed again...

    Unity, please get your stuff together and fix this!
     
    chai and outtoplay like this.