Skip to content

Commit

Permalink
Fix issue with null errors on first adding a dropdown (before seriali…
Browse files Browse the repository at this point in the history
…zation)
  • Loading branch information
Jonathan Levin committed Aug 20, 2021
1 parent f7d96c8 commit 7d174c4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public static void Dropdown(
int newIndex = EditorGUI.Popup(rect, label, selectedValueIndex, displayOptions);
object newValue = values[newIndex];

if (!dropdownField.GetValue(target).Equals(newValue))
object dropdownValue = dropdownField.GetValue(target);
if (dropdownValue == null || !dropdownValue.Equals(newValue))
{
Undo.RecordObject(serializedObject.targetObject, "Dropdown");

Expand Down

0 comments on commit 7d174c4

Please sign in to comment.