Closed sergeikat closed 3 years ago
Hi, The relevant section of the log is this:
Module HitpointTracker threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object
at BDArmory.Core.Extension.PartExtensions.GetSize (Part part) [0x00006] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Extension.PartExtensions.GetAverageBoundSize (Part part) [0x00000] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.CalculateTotalHitpoints () [0x00016] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.SetupPrefab () [0x00011] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.OnStart (PartModule+StartState state) [0x00611] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at Part.ModulesOnStart () [0x00120] in <cd473063d3a2482f8d93d388d0c95035>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
[FlightIntegrator]: Reloaded drag cube for zeroed cube root part flag(Clone)(Clone) on vessel Flag
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
Module HitpointTracker threw during OnUpdate: System.NullReferenceException: Object reference not set to an instance of an object
at BDArmory.Core.Extension.PartExtensions.GetSize (Part part) [0x00006] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Extension.PartExtensions.GetAverageBoundSize (Part part) [0x00000] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.CalculateTotalHitpoints () [0x00016] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.SetupPrefab () [0x00011] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.RefreshHitPoints () [0x00016] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at BDArmory.Core.Module.HitpointTracker.OnUpdate () [0x00000] in <eafd5537b6f64677b27070e8e2c98fb0>:0
at Part.ModulesOnUpdate () [0x0004a] in <cd473063d3a2482f8d93d388d0c95035>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
recalculating orbit for flag(Clone)(Clone): Mun ( Update mode TRACK_Phys )
rPos: [-157255.07134667, 4932.76462459564, 127375.276216835] rVel: [-5.75836280126567, -1.74622982740402E-10, -7.10916419613119] |9.14871344608376|
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
recalculated orbit for flag(Clone)(Clone): Sun ( UT: 41029.517040797 )
rPos: [NaN, NaN, NaN] rVel: [NaN, NaN, NaN] |NaN|
Delta: [NaN, NaN, NaN] / [NaN, NaN, NaN]
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
I've fixed the NullReferenceException
in BDArmory.Core.Extension.PartExtensions.GetSize
, which is caused by the flag not having a MeshFilter
, but I'm not sure what is causing the flag's orbit to be recalculated as NaN
as the log doesn't provide any reason for recalculating the flag's orbit. It's this NaN
that then goes on to break the view frustrum and crash KSP.
One potential cause of this might be the "Kerbal Safety" setting in BDArmory. If you have the "Kerbal Safety" slider (about half-way down the "General Slider Settings" section of the BDArmory settings) set to "Full", then turn it down to "Partial" as the "Full" setting has been known to occasionally cause NaN
orbits before (for a while it defaulted to "Full", but now it defaults to "Partial" due to this issue, which I haven't been able to fix).
If you're playing in career mode, then you most likely want to turn it down to "Off" instead so that it doesn't interfere with missions at all.
Could you try with this change and say if it fixes the problem or not?
Hi, Thanks for the reply. I have just tried making this change to the Kerbal safety slider, the crash still happens whether set to Full, Partial or Off., so it seems that is not the casue of the issue...
OK, after some more testing, I'm finding that reverting the fix for the NullReferenceException
in BDArmory.Core.Extension.PartExtensions.GetSize
triggers the behaviour you described and after adding it back in again, the flag deploys properly.
So, I think what's going on is that the exception in GetSize
is interrupting the Part.ModulesOnStart
function for the flag, preventing it from being set up properly, but ModulesOnStart
is not a Unity Behaviour
, so the Behaviour
for the flag part continues running. Then shortly afterwards, the orbit for the flag is recalculated for some reason, which is giving the NaN
s due to not being set up properly and breaking the view frustrum, which causes KSP to crash.
In other words, I think fixing the NullReferenceException
in BDArmory.Core.Extension.PartExtensions.GetSize
fixes this issue.
alrighty, sounds promising and I'm glad we have potentially found the root of the issue! I'm useless when it comes to modding so I look forward to an update/hotfix for this, and hopefully this will fix it. I'm using CKAN, so not sure if there's any difference in timings there but I will let you know if there are still any issues afterwards.
Thanks for your time, and help in fixing this issue!
We'll hopefully have the next bugfix version (v1.4.8.3) out soon, which will include this fix. CKAN usually updates within an hour of me updating it on SpaceDock.
sounds good, thanks for all your work, really appreciate it.
v1.4.9.0 is now on CKAN (we decided to increase the minor version number instead of the bugfix number due to the amount of other improvements we added; you can see the changelog here: https://spacedock.info/mod/2487/BDArmory%20for%20Runway%20Project#changelog). Can you test it to check that it fixes the issue for you? Then I can close this issue. Thanks!
Just tested, Issue appears to be fixed now, flag is now placed correctly with no crash. Thanks for your help, I think this is case solved!
Excellent, thanks!
Hi, Have found an issue and narrowed it down to the BDA Runway project mod. Placing a flag causes the animation to play, however the flag has no model or collider, followed by a game crash. not sure why exactly, but I have narrowed the fix down to be removing this mod. Player.log is attached. https://www.dropbox.com/s/tjkzxf45t1wm2pi/Player.log?dl=0