Can't Re-Order Lists in Inspector

Hello,

I was working in Unity 2020.2.0f1 when I realized that my Lists weren’t re-orderable. I thought that maybe it was a version issue so I upgraded my project to 2020.2.6f1 via UnitHub. However, I still can’t seem to make my Lists re-orderable.

I created a fresh projcect and it doesn’t have this issue. But I really don’t want to have to copy all my project files into another project and redo my scenes/settings.

Is there a way to update the inspector to properly show my Lists as re-orderable?

Thanks!

Solved!

Okay so it was actually a script causing the issue— one I completely forgot I had.

The troublesome script was DefaultEditor.cs. I was using it to force every editor to use UIElements, however, I guess it didn’t work properly for lists.

Here is the script (taken from Property Drawers ):

using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;
using UnityEditor.UIElements;


[CustomEditor( typeof( Object ), true, isFallback = true )]
public class DefaultEditor : UnityEditor.Editor
{
    public override VisualElement CreateInspectorGUI()
    {
        var container = new VisualElement();

        var iterator = serializedObject.GetIterator();
        if ( iterator.NextVisible( true ) )
        {
            do
            {
                var propertyField = new PropertyField( iterator.Copy() ) { name = "PropertyField:" + iterator.propertyPath };

                if ( iterator.propertyPath == "m_Script" && serializedObject.targetObject != null )
                    propertyField.SetEnabled( value: false );

                container.Add( propertyField );
            }
            while ( iterator.NextVisible( false ) );
        }

        return container;
    }
}

Removing that script and just dealing with the default GUI seems to have resolved the issue.

1 Like