Principia does not run in debug KSP

This issue has been tracked since 2022-09-04.

I suspect the issue was introduced in #3303. #3201 is also suspect.

What I believe to the cause (apologies for screenshot-of-code):

image

cc @StonesmileGit

StonesmileGit wrote this answer on 2022-09-10

This NRE gets spammed while in a save:

[EXC 21:38:02.061] NullReferenceException: Object reference not set to an instance of an object
	principia.ksp_plugin_adapter.PrincipiaPluginAdapter.OnGUI () (at <29cbeb58583d4aa39b0d1d244f47f24e>:0)
pleroy wrote this answer on 2022-09-10

For the uninformed: what is "debug KSP" and where do I buy one?

al2me6 wrote this answer on 2022-09-10

It is running KSP's unity in debug mode. cf. https://gist.github.com/gotmachine/d973adcb9ae413386291170fa346d043

pleroy wrote this answer on 2022-09-10

I think it needs lazy initialization of psychohistory_mesh_, prediction_mesh_, target_psychohistory_mesh_, and target_prediction_mesh_ in class Plotter.

DRVeyl wrote this answer on 2022-09-10

Essentially yes. You're instantiating Unity objects during the Plotter constructor [static declarations at the class level], which is not allowed. The exception is swallowed or suppressed in non-debug mode. More appropriate would be to put those initializations into a new Plotter.Awake() method, which gets automatically called right after the constructor.

More Details About Repo
Owner Name mockingbirdnest
Repo Name Principia
Full Name mockingbirdnest/Principia
Language C++
Created Date 2014-02-08
Updated Date 2023-03-29
Star Count 664
Watcher Count 29
Fork Count 62
Issue Count 109

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date