- Home /
How to retain reference to a ReorderableList element even when it's reordered?
I am making custom editor scripts for a potential framework I'm making. I have an EditorWindow displaying an UnityEditorInternal.ReorderableList
to mimic the behavior of the sorting layer editor. I also have an custom inspector wherein you can select from the elements of the list (again, like what the sorting layer does). What can I do to mimic the behavior of the sorting layer such that even if I reorder the list in the editor window, the element I selected in the inspector wont change?
UPDATE: Since I'm using SerializedProperty
in the custom editor, I /might/ be able to achieve this if I could somehow use the SerializedProperty.objectReferenceValue
and assign the reference to the list element. But I cannot use it unless the class of that element derives from UnityEngine.Object
, and I cannot do that because it messes with my serialization.