I have no idea about that, personally, but a quick google search showed me this:
It’s ‘for’ not ‘foreach’ but it definitely includes Next (true) 2 or 3 times , but Next(false) through the loop.
It’s a long answer, I figure it might help ya.
The assertion explains what is happening: You need a single call to serializedProperty.Next(true) before you can start iterating in a foreach block.
SerializedProperty serializedProperty = serializedObject.GetIterator();
serializedProperty.Next(true); // this is the missing ingredient
foreach (var item in serializedProperty)
{
EditorGUILayout.PropertyField((SerializedProperty)item);
}
Sorry for bumping this old one but what kru posted above did not work for me (Unity 2019.4LTS). The exception vanished but not iteration took place. I ended up using this code: