BeginChangeCheck & EndChangeCheck not working?

I can’t seem to get EditorGUI.BeginChangeCheck() and EditorGUI.EndChangeCheck() to properly save changes made to a EditorGUILayout.Popup(). Here’s my block of code, running inside OnInspectorGUI() of a Custom Editor.

EditorGUI.BeginChangeCheck();
useTextBank.selectedBank = EditorGUILayout.Popup(useTextBank.selectedBank, useTextBank.textBank.bankSets [0].textItems.ToArray());
if (EditorGUI.EndChangeCheck()) {
	useTextBank.RefreshText();
	Undo.RecordObject(useTextBank, "Select TextBank");
}

I’m trying to match the usage defined here: Unity - Scripting API: EditorGUI.BeginChangeCheck but the modified object doesn’t not save with scene/prefab after modifying it’s popup in the inspector, nor does an Undo entry get created. I’m using Unity 5.6.4.

I don’t have all the context here, but from the looks of it I think the problem is that you are not using Undo.RecordObject at the right time. Per the documentation, you should call it before you make changes, and it looks here like you are calling it after.