Jump to content

Easy way to quickly test and debug plugin code?


Recommended Posts

A few years ago I started learning C# for the sole purpose of modding KSP. I quickly lost interest because I had to keep running KSP every time I wanted to visualize my plugin code. I've been away from KSP for awhile, and I apologize in advance if this has been answered somewhere, but is there an easy way to run code in Unity to quickly visualize, test, and debug code for a KSP plugin app? I know many aspects of plugins require interaction with the player in-game to work (like an autopilot) so, specifically, I would like to be able to develop a complex UI before I start running it in KSP. I develop simple games in Unity now, and it's so nice to quickly click the play button to see quick incremental changes in my code.

Link to comment
Share on other sites

KSP uses Unity's UI system, and it's easy to load asset bundles created through Unity. So you can create your UI entirely withing Unity, but it is sort of tricky. You can't import anything from KSP into the Unity editor, so all of your UI code has to be maintained separately from anything that touches KSP.

So you can can make the UI (using either default style elements, like the sprites for buttons, toggles, windows, etc..., as placeholders, or you can generate your own, using the old Unity "Ghost" UI elements), write the code for buttons, assigning text, toggles, etc..., but then you have to go through some tedious work-arounds to actually communicate with KSP. And since you can't do anything with KSP in the Unity editor your UI will most likely not really work withing Unity. It really just depends on how much of your UI is dependent on KSP, and how you write the code to control the UI.

It's very simple to create the shell for your UI entirely within Unity, but getting things actually working is going to require a lot of the same old, start, re-compile, restart, change the UI, restart, restart, restart...

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...