Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Principia does not run in debug KSP #3436

Closed
al2me6 opened this issue Sep 4, 2022 · 5 comments · Fixed by #3437
Closed

Principia does not run in debug KSP #3436

al2me6 opened this issue Sep 4, 2022 · 5 comments · Fixed by #3437
Assignees

Comments

@al2me6
Copy link
Collaborator

al2me6 commented Sep 4, 2022

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
Copy link

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
Copy link
Member

pleroy commented Sep 4, 2022

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

@al2me6
Copy link
Collaborator Author

al2me6 commented Sep 4, 2022

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

@pleroy
Copy link
Member

pleroy commented Sep 4, 2022

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

@DRVeyl
Copy link

DRVeyl commented Sep 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants