1.8.2: Fixed a couple of more issues with certain using EditorGUI.PropertyField, and removed label element from SerializeReferenceTo when used in an array

This commit is contained in:
Anders Ejlersen 2023-04-23 17:38:47 +02:00
parent b189ec8b97
commit 61c7356b3a
5 changed files with 15 additions and 10 deletions

View file

@ -40,8 +40,11 @@ namespace Module.Inspector.Editor
height = EditorGUIUtility.singleLineHeight
};
SerializedProperty parent = property.GetParent();
GUIContent labelContent = parent != null && parent.isArray ? GUIContent.none : label;
int index = Array.IndexOf(arrStrings, ConvertUnityTypeFullnameToCSharpName(property.managedReferenceFullTypename));
int newIndex = EditorGUI.Popup(rect, label, index, arrGui);
int newIndex = EditorGUI.Popup(rect, labelContent, index, arrGui);
if (newIndex != -1 && index != newIndex)
{
@ -53,7 +56,7 @@ namespace Module.Inspector.Editor
EditorUtility.DisplayDialog("Error", "Failed to set managed reference to selected type.\n\nType must be:\nSerializable\nNot abstract\nNon-generic\nNot a specialization of UnityEngine.Object", "Ok");
}
EditorGUI.PropertyField(position, property, true);
EditorGUI.PropertyField(position, property, GUIContent.none, true);
}
EditorGUI.EndProperty();
bool hasChanged = EditorGUI.EndChangeCheck();