Mod Project Structure

Unity project structure

The Unity project’s Assets folder is structured as follows:

  • AddressableAssetsData - contains configuration for the addressables groups, you should generally not modify this manually.

  • DoNotDistribute - files from your local game install may be copied here, always make sure that this folder and its content is excluded from Git and isn’t committed to the repository or publicly shared in any other way.

  • Mods - folder from which mods will be loaded when running the game in the editor play mode. You can put your mods’ dependencies here to make them load. When you test your mod in the editor, its files will be placed into a __Testing subfolder here.

  • Scenes - contains the default scene file, but it is not necessary, and you can for example create scenes for testing in your mod folders.

  • StreamingAssets - destination for the build process of addressable bundles and sound banks. You generally want to avoid committing build results to your repository.

  • ThunderKitSettings - holds information about your KSP2 import configuration and other ThunderKit assets.

  • <YourMod> - folders named after each mod’s ID, which contain all assets and code for the respective mods. Its structure is explained in the following section.

Mod folder

When you create a mod with code in the Redux SDK window, you will get the following structure in the mod’s folder in Assets:

  • Code - all of your mod’s code must go into this folder, unless you create your own different assembly definition elsewhere.

    • <YourMod>.asmdef - the assembly definition of your mod, you can add DLL references here.

    • <YourMod>Plugin.cs - your mod’s entrypoint script with lifecycle methods.

  • Copied - everything in this folder will be simply copied to the resulting mod folder after build. It can include Patch Manager patches in the patches subfolder, CSV localizations under localizations, etc.

  • Pipelines - contains ThunderKit pipelines for building and deploying the mod. You don’t need to use these directly, instead, use the KSP2 Unity Tools window.

  • swinfo.asset - this is your mod’s definition, carefully fill in all details, as it will be used to generate swinfo.json during build, which is distributed with your mod and is required by the game to properly load your mod. Its Features section declares the campaign features of your mod. The build also writes these features into swinfo.json.

Addressables

Several groups of addressables are automatically created for you along with your mod:

  • addressables_<YourMod>_all - a general group for any assets.

  • <YourMod>_cbs - a group for adding new celestial bodies.

  • <YourMod>_experiments - a group for new science experiments.

  • <YourMod>_missions - a group for adding missions.

  • <YourMod>_parts - a group for adding new parts to the game.

  • <YourMod>_tech_nodes - a group for adding new tech tree nodes.

All the content in the groups of your mod loads only in campaigns that have your mod on. Content can belong to one of the other features of your mod, for example parts that are only for a hard mode. That content gets feature: Addressables labels. To set these labels, use one of these:

  • The Open Asset Features button on the mod definition.

  • Modding > Asset Features...

See Campaign features.