Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug Unable to reorder game objects in prefab

Discussion in '2020.2 Beta' started by castor76, Jul 3, 2020.

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I think this is happening for recent 2020.2a16.

    When you drag the game objects inside prefab editing, you are not able to move them around to reorder them anymore.

    I am pretty sure it worked at a15 .. or at a13?

    I am not going to send another bug report as this is simply too easy to reproduce.
     
    Last edited: Jul 3, 2020
    sama-van likes this.
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    I'm having the same issue (Windows 7, 2020.2.0a16).
     
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yeah, This has to be a bug! Serious one at that!
     
    sama-van likes this.
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    We'll have a look. For future references, please consider submitting reports before posting on the forum. That will ensure that the issue does get looked into. The forum is not set up for bug reporting.
     
  5. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    adamgolden likes this.
  6. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Thanks for taking a look. I did consider submitting a bug report, but I have been doing so often these days and I didnt want to submit yet another same project all over again and again. I guess I felt a bit too tired of it... sop..
     
    LeonhardP likes this.
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    If you don't want to submit bug reports, you should probably not be using an alpha version of the editor.
     
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Don't get me wrong, I do submit bug reports, but I have already done with my current project multiple times already and felt a bit tired of sending exact same project all over again. It's not like it takes 1 mins to do it... and since the issue was very easy to reproduce I thought I skip this one.
     
  9. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    If you already submitted the project in a previous report, it is enough to reference the ticket number of the report where it was attached to. No need to upload the same project multiple times.
     
  10. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Is this bug fixed in 2020.2 a17 released today?
     
  11. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    No
     
  12. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    The fix should be part of a18.
     
  13. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Same issue here wtih a16 on 2 windows machine.
    It doesn't make sense to release a version where you cannot order the prefab structure.
    What's so annoying is "it's ok guy let skip it on 17 and keep that on 18".

    No idea how you guess people working with a16/17 if they cannot edit their prefab.
    Who manage this? skip it!
     
  14. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yeah, this is pretty urgent bug, I am hoping a18 comes out pretty quickly. Quicker than usual!
     
  15. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Here's a quick/minimal workaround for use in a pinch:

    temp_reorder_workaround.jpg

    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR
    3. using UnityEditor;
    4. using UnityEngine;
    5. [CustomEditor(typeof(Transform))]
    6. public class TempReorderWorkaround : Editor
    7. {
    8.   public override void OnInspectorGUI()
    9.   {
    10.     base.OnInspectorGUI();
    11.     if (target == null) return;
    12.     Transform t = (Transform)target;
    13.     if (t.parent == null) return;
    14.     Transform p = t.parent;
    15.     if (p.childCount == 1) return;
    16.     GUILayout.Space(5);
    17.     GUILayout.BeginHorizontal();
    18.     if (GUILayout.Button("Move Up")) { t.SetSiblingIndex(Mathf.Max(t.GetSiblingIndex() - 1, 0)); EditorUtility.SetDirty(p); }
    19.     if (GUILayout.Button("Move Down")) { t.SetSiblingIndex(Mathf.Min(t.GetSiblingIndex() + 1, p.childCount + 1)); EditorUtility.SetDirty(p); }
    20.     if (GUILayout.Button("First")) { t.SetAsFirstSibling(); EditorUtility.SetDirty(p); }
    21.     if (GUILayout.Button("Last")) { t.SetAsLastSibling(); EditorUtility.SetDirty(p); }
    22.     EditorGUILayout.EndHorizontal();
    23.   }
    24. }
    25. #endif
    26.  
    Edit: Added EditorUtility.SetDirty calls - I tried using Undo.RecordObject but it wasn't getting flagged for saving.. this is working though.
     
    Last edited: Jul 13, 2020
    sama-van likes this.
  16. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Haha.. such a hackish but cleaver work around! So sad that we have to resolve to this.. but thanks!
     
    sama-van and adamgolden like this.
  17. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    The same thing works for RectTransform, just give it a different class name and change line 5 to [CustomEditor(typeof(RectTransform))]
     
  18. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    a18 working a charm!
    Prefab fixed :)
     
    adamgolden likes this.
  19. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    a18 released ?

    Let me check!!!!
     
    sama-van likes this.