Configuring the part in Unity
The following page will guide you through setting up a new part inside Unity.
Prerequisites
Texturing the mesh in Substance 3D Painter
Setting up the scene
Open Unity Hub.
Open the Unity project.
Click on the three dots in the Hierarchy menu then “Add a new scene”.
Right-click on the scene > Save Scene.
Save the scene in the Asset folder of the Unity project.
In the Asset folder, create a folder for the mod.
In this folder, create the “Materials” and “Parts” folders. This is just to keep the folder well organized.
Delete the camera and light and import the meshes and textures into the corresponding folders.
Good practice for organizing the Assets folder
Assets
|
\-Modname
|
\-Parts
| |
| \-(separate folders for the type of parts)
| |
| \-Folder for each part
|
\-MaterialsAssociating textures to the meshes
Create a material in Unity for each material in Substance Painter (right-click on the project window > Create > Material)
Select all materials. In the Inspector window, in Shader, select KSP > Parts > Paintable.
For each material, assign the textures to the Albedo, Metallic, Normal, Emissive and Paintable channels.
For Normal channels, click the “Fix Now” button.
For each mesh, assign the materials to the corresponding locations. Click on “Apply”.
Adding meshes to the scene
Create an Empty GameObject. Let's name it
myMod_myPart. The name must be unique to any part in KSP2, including other mods.Set its position to
0;0;0.Create another empty object as a child of this object and call it
model.Drop the mesh as a child of
model.Use the “Transform” panel to optionally modify the position, rotation and size of the mesh.
Right click on the mesh > Prefab > Unpack completely.
Select all colliders.
In the Inspector window: Delete the “Mesh Renderer” component. Click on Add Component > Mesh Collider. Check “Convex”.
Repeat the operation for all meshes.
Note: Materials should not have shaders.
Configuring the part data
Follow these instructions: Configuring core part data
Configuring the addressables
Creating the addressables
If you followed the "Configuring the core part data" instructions linked above, you should have an addressables group set up for your mod with your prefab and JSON files already added.
Next, select all icon images in the Asset folder and check "Addressable" in the Inspector window.