Closed Lisias closed 2 years ago
Thinks appears to be simpler than that. I was just "commiting" the Settings changes disregarding the current scene, and so VesselDraw was being ignited when it should not.
So it ended having always the current vessel on the database already and starting the scene without housekeeping the DB.
This was fixed by side effect on Release https://github.com/net-lisias-ksp/DistantObject/releases/tag/RELEASE%2F2.1.1.6 that essentially reworked VesselDraw
and eliminated the problem.
So I'm closing this and marking it as 2.1.1.6 milestone.
Fellow Kerbonaut Krazy1 found something interesting:
log.zip
My best guess to this point is that he found a borderline situation: the craft entered into Physics Range in the exact same moment DOE checked if it was loaded or not, and we got a race condition.
Thinking about, I need to put something on the FixedUpdated handler. One of the speed ups I made was to remove the mesh building phase from the FixedUpdate (as it was before), and besides this handler is called fewer times then Update, it is called from the hottest code on the Game, the Physics Engine. But now I realised that there was a reason for using the FixedUpdated.
I will need to rework a bit this thing - shoving everything on FixedUpdate is not an option, I will not put render time code inside on the Physics Engine loop.
In the mean time, this bug is harmless - other than spamming a bit the KSP.log, nothing bad happens as the code abort the drawing.