Hi,
I have simple EditorWindow which allows me to select one of ScriptableObjects and then draws default inspector for that ScriptableObject below. I wrote this long time ago and it used to work just fine but since Unity version 2021 i can’t edit values in arrays. I can add and remove elements but when i edit values inside it gets instantly reverted.
Here’s the code:
void OnGUI()
{
GUILayout.Label("Select Configuration", EditorStyles.largeLabel);
var configurations = LoadAll();
var names = configurations.Select(c => GetTypeName(c)).ToArray();
_selectedConfiguration = GUILayout.SelectionGrid(_selectedConfiguration, names, 5);
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
var selectedObject = configurations[_selectedConfiguration];
GUILayout.Label(GetTypeName(selectedObject) + " configuration", EditorStyles.largeLabel);
if (selectedObject != null)
{
var editor = Editor.CreateEditor(selectedObject);
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition);
editor.OnInspectorGUI();
GUILayout.EndScrollView();
}
}