I suddenly got this error when I play the game on the editor on the second time. The first play mode works fine, but after that I couldn’t play the game anymore because of this error unless I restart the editor. It’s very annoying.
I checked the code and the error is caused by this method in ComponentSystemBase:
internal SystemState* CheckedState()
{
var state = m_StatePtr;
if (state == null)
{
throw new InvalidOperationException("system state is not initialized or has already been destroyed");
}
return state;
}
I don’t know where it is assigned other than it is set to null in OnAfterDestroyInternal().