Normally, calling UniqueIDsManager.GetNextID gives a warning when that happens, which made me realize that it's potentially unsafe to do so - the IDs may have not been loaded at that point. This should not happen when saving the data, as the session should exist at that point.
The solution here is to only create the session when Scribe.mode is LoadSaveMode.PostLoadInit. This ensures the IDs are initialized and getting the next ID won't cause any issues.
Normally, calling
UniqueIDsManager.GetNextID
gives a warning when that happens, which made me realize that it's potentially unsafe to do so - the IDs may have not been loaded at that point. This should not happen when saving the data, as the session should exist at that point.The solution here is to only create the session when
Scribe.mode
isLoadSaveMode.PostLoadInit
. This ensures the IDs are initialized and getting the next ID won't cause any issues.