Tutorial - How to start making Custom Parts

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#1
Hello
Just another tutorial to fill up this section.

What is currently very well known by the SFS community, is that modding SFS is possible. The discovery of modding helped much the community to add more mods to the game, and it also introduced more people to modding

However it's only possible to make mods for the Steam version since the Mobile version has the current limitations that make it not able to load and make mods.

About Modding:
Modding is basically split into 3 different areas:
  • Mods: Basically the area that involves C# coding language knowledge. These are generally considered true mod. For example ANAIS and Vanilla Upgrades.
  • Custom Parts: Adds custom parts to the game, they can have various functionalities and are usually parts that would not be included in the stock version of the game.
  • Custom Textures Packs: Not much associated with modding, the only area were you can't get the modder badge, it's also the easiest area of modding and has the name suggests. It only adds custom textures to the game.
Now, this tutorial will only explain a bit how you can start making custom parts, so we can exclude talking about the other modding areas.

This tutorial is a shortened version of the much more detailed custom part tutorial that Lemniscate Biscuit made on the SFS wiki

For the purposes of the tutorial, notes and modding components will be labeled in [brakets], (prenthesis) or with italics or bold.

Now lets actually start the tutorial:
-- Glossary --
-- In a Nutshell --
"Kurzgesagt reference lol"

To navigate the river of modding, you'll need a wading suit of vocabulary. For your reference, here are some words you should know. "duolingo reference???"
  • Prefab - Any custom part that you make. They will usually look like blue cubes viewed at an angle or show their contents when viewed in the menu.
  • Part - Any component that can be interacted with and used to create a rocket, craft or structure.
  • Path - Any set of folders you must click on to get to a specific folder or location. They are marked in this article with italics and > symbols, symbolizing the next step needed.
  • Hierarchy - The hierarchy is the list of components that make up a custom part. The hierarchy is located on the left side of the screen.
  • Child - A child is any element under another element in the hierarchy.
  • Parent - A parent is any element above another element in the hierarchy.
  • Modloader - The tab and space in the SFS main menu screen that allows mods to be toggled on and off.
  • Unity - The mod creation program that is version 2021.3.11.
  • Unity Hub - This is where you Unity project lives.
  • Odin Inspector - This program creates Unity's user friendly UI that you use to create your parts.
This labeled screenshot is here to help you locate the different parts of the modding experience.
Unity Labeled.png

-- Dependencies --
-- In a Nutshell --
"Kurzgesagt reference lol"

Making custom parts requires some tools, some of them I'm sure y'all have already heard about.
What you will need to start making Custom parts is:

  • A computer: this one is obvious but only added this here because some people can think that it's possible to make mods on/for mobile, which is not possible currently;
  • Unity Hub (Unity.com | Download): don't have much to explain, this is the main program you will need to use;
  • Unity Version 2021.3.11 (Unity.com | releases | 2021.3.11): this is the Unity version you will need to use when creating custom parts, don't download the 2021.3.1 Version because this one doesn't have an option to export the Unity package with Mac compatibility, also for exporting the package with Mac compatibility you will need of the Mac Compiler module (See the second post to know how to add this);
  • Odin Inspector Trial (OdinInspector.com): This program will allow you to edit the parts and the scripts on the Unity program, also Odin Inspector has a free trial of 90 days and it doesn't rely on the IP to see if you have downloaded it before, so you could use as many accounts as you want to download the free trial version. (I don't recommend people to exploit this actually, if you can buy it, just buy it, also by buying it you are supporting the Odin Inspector company at maintaining this amazing program)
  • SFS Modding Toolkit (GitHub.com | Stef-Moroyna | Spaceflight Simulator ModdingToolkit): This last and also very important "tool" is the one you will need for you to start your custom part creation journey, its there that are the SFS scripts, resources and almost all of the SFS parts, including even 3 "old" parts that were from the removed Electricty update. To download it click on the link, you will see a green button called "Code", click on it and click in "Download ZIP"
  • GitHub Account: This one is not necessary, but it's still highly recommended to keep the tracks of your mods updates and uploads.

-- How To Setup These Programs --
-- In a Nutshell --
"Kurzgesagt reference lol"

After you have download all of these programs, install the Unity Hub program and make a account for it, this is also necessary because you will need to get a free license to actually use the program. For making/adding that license you will need to open Unity Hub after you installed and log in. Click on your profile that is on the top left corner of the Unity Hub program and go to Manage Licenses, click on the Add button and select Get a free personal license and just agree to it.

Execute the Unity 2021.3.11 setup program that you have downloaded, then extract the SFS Modding Toolkit.zip file, open Unity Hub and click on Add that is on the top right corner of the Unity Hub main page, after that, search on the file explorer of windows and search for the extracted SFS Modding Toolkit file, go inside of the folder when you have found the extracted file, select the Modding folder and then open it, then just wait a moment for your project to load.

Then you just need now to open Odin Inspector Trial as a package. For that, open the project you made with the SFS Modding Toolkit, then search in the top menu for the Assets button. Click it and then click on, Import Package then Custom Packages. Select Odin Inspector Trial as a Unity Package. After you've done it, restart Unity and voila, you are now ready at starting your journey.

-- How To Make Custom Parts From Scratch --
-- In a Nutshell --

"Kurzgesagt reference again lol"

After you have completed the guide on how to setup the essential programs, you are now able to make custom parts. Making custom parts is only a matter of: trial, error, effort and perseverance. And also debug your custom parts lol. (I talk from personal experience)

So, now you may be asking: "Where can I find one of the holy grails at making custom parts in Unity?"

After you opened your project and waited an eternity for it to load, you can see that you're in a folder named Assets with a huge amount of other folders. To access the SFS Custom Part Creation Holy Grail, you will need to go to the Resources folder, then you will go see some folders that can also be of your interest on the future, I'm not going to cover them for now.

After you went to the Resources folder, click on Parts (not the Part Textures for now), and you will find it, the Holy Grail you were looking for, on that folder you will see first some of the general parts you know (Fuel Tanks, Capsules, Solar Panels, etc...), now you are ready to make custom parts, you already know where are most of the SFS parts, the Engines, Fairings, Structural, etc. You can also make another folder if you want to have your own custom part pack mod organised (this is very recommended).

Note: Mercury, Atlas, Redstone and career parts are not in the toolkit.

Right click on your project (the area that is on the bottom) and then click Create then, Prefab. A Prefab is basically a part, you just need to think that each prefab is a custom part you made. From here, you can create anything your heart desires (kind of).

To see more about on how to actually make custom parts themselves I recommend to see the Fandom tutorial. It is significantly more detailed than this abridged forum version.

There are also some videos on YouTube about how to start making custom parts from scratch and I recommend to see:
Livestream from PicoSpace Industries:

Video from 105Code (The video is in Spanish but you can activate the subtitles):

To be continued in the next section!
 
Last edited by a moderator:

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#2
-- How To Export Your Custom Part Pack --
-- And other things --

"You expected to see another Kurzgesagt reference right?" In a Nutshell - lol

When you decide to export your parts, you will need to right click on your project folder, inside of the mod folder you're using and then click on: Create then Pack Data. You will have to fill that pack data with some things, like, mod name, version, image (optional), now the other thing that what you will also need to export your mod. You will need of a custom assetbundle tag, for that click on the custom part you made (don't open it or double click) and you will see on the bottom an AssetBundle thing. Click on it and then click on New and then just name it to whatever name you want, however you have to be careful with the amount of characters used and things like that, for example, some that I use are: sfs_cet1 (custom engines 1) and sfs_dah_ksp1.

Now on the top of your Unity project, you will see a button named just SFS, on that you will see another button named Build Pack. A new window will open after it is clicked. Select the Pack Data you previously made, then on the Asset Bundle Label, click on it and select the custom asset bundle you previously made.

After that just fill the Output File name with the name of your mod and the version if you want. On the build platforms just click on Windows (MacOS if you have the previously mentioned Mac Compiler Module), click on build mod, you will see a window appear after that, you can just ignore it. Close or click on the cancel button, then the mod will then be built.

Now to find the mod in the .pack file format, you will need to search on the file explorer of your computer and search for the modbuilder folder, this is usually the path you will find it:

Spaceflight-Simulator--ModdingToolkit-main\Modding Toolkit\Assets\ModBuilder

After you have found it, just select your custom part pack that is the one with the .pack format and put it on your SFS custom parts folder.
You may have seen other files in the modbuilder folder after you built the mod. That file is in .meta format and is basically just garbage used by Unity for identification purposes (I mean probably). After removing the pack, delete the .meta file as Unity will get very angry if you leave it in there without its mod.

-- Error Codes You May Find --
So, while you make and test your custom part pack, one will probably encounter errors either in Unity or in game.
Thank you Lemniscate Biscuit for letting me use this part and complete it:

Note by Lemni: The Error Codes section was originally written by waterfalls :> on discord (also known as krazythief20543 on his Fandom Wiki Account) but Lemni helped on formatting that section for this tutorial.

As a general rule of thumb, check each prefab before building the mod to prevent extra headaches. Odin's built in bug finder can also help detect bugs. Additionally, pressing the SFS F1 menu can find other hidden problems.

Object Reference Not Set to an Instance of an Object:

If you load SFS with your mod and the object reference not set to the instance of an object error appears, it means that you have left something blank in a script in a prefab. (e.g. You forgot to assign a child in a prefab to be transformed), which meant that value in transform module is blank.
This error can also be caused if the mods needs of a dependency, for example if your part pack needs of the Electricity part pack, but that problem usually only happens if you're trying to make a part pack in which it uses resources of another part pack.

Index was Out of the Bound of the Array:
If you get the index was out of the bounds of the array error, it is to do with the part module, specifically the priority of the prefab in game. This is a more rare message than the above and the "best" way is to try having a non negative priority value.

Stack Overflow:
If you get a stack overflow error in Unity, it is most likely to do with a pipe/polygon (Simple or Custom) having a weird UV value (UV means X and Y co-ordinate of a point) and the best thing is to try to press ctrl+z to try revert to the step that caused it. If Unity freezes or if it is stuck in a loop, restart the program and try above step. If it still doesn't work, then you may have to delete the pipe/polygon module causing the issue and make a new one.

-- Making your mods Mac Compatible --

Didn't had enough space on the first post was already said, but I'll try to change it to include this part that is also very important.

Credits to waterfalls :> and Vapor Space on discord, thank you very much to those 2 users for this very useful step!

Mac compatibility is available by going into Unity Hub, then Installs, then pressing on the cog icon in the section for 2021.3.11.f1. Click Add modules then select Mac Build Support (Mono) for Mac support and Universal Windows Platform Build for Windows support.

--------------------------------------

Questions related to how to put your custom part packs on the correct folder or about general modding, go to this thread: Mods and Installation | Questions and Answers

Any more questions or information that could be added to this thread, tell, and I will find a way to explain it and add to this post, or to a new one if this starts to reach the character amount limit lol.

Edit: Explanations and/or informations present here may change in the future for better and clearer explanations about this topic.
 
Last edited by a moderator:

Altaïr

Space Stig, Master of gravity
Veteran
Modder
Deja Vu
Hot Stuff
Swingin' on a Star
Atlas
Forum Legend
#8
I finally took the time to review it. I moved it and pinned it. My congratulations, this will be very useful :)
 

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#9
I finally took the time to review it. I moved it and pinned it. My congratulations, this will be very useful :)
Oh wow, thank you!!
If possible I'll also try to make another one for SFS 2 since there will be a lot of us modders that will want to research about it and how to mod there.
 

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#11
I think giving link to wiki will be a good idea as you won't have to also edit everytime wiki is edited
I've actually linked on the first post 2 or 3 times the site to the fandom wiki tutorial if that's what you're referring.
But now that you say tha I remembered I'll also have to include you on that part lol (sorry)
Now, this tutorial will only explain a bit how you can start making custom parts, so we can exclude talking about the other modding areas.
This tutorial is inspired on the SFS Fandom page that @Lemniscate Biscuit made (SFS Fandom.com | Custom Part Creation), and also on the amount of players that have been asking me things about how to start making custom parts.
 

ilikespace

Planet editor
Recruit
Hot Stuff
Space Glider
Swingin' on a Star
Planet Sculptor
Atlas
Voyager Quest
Floater
#12
Might be a me problem but editor application thing doesnt install in version you send here
Edit: nevermind it works
 
Last edited:

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#15
Dahzito help me i made it but cant find the project folder
You cannot find the project?
Maybe see this step again?:
Install Unity 2021.3.11 setup program that you have downloaded, then extract the SFS Modding Toolkit that is on the .zip file, open Unity Hub and click in "Add" that is on the top right corner of the Unity Hub main page, after that, search on the file explorer of windows and search for the extracted SFS Modding Toolkit file, click it when you have found the extracted file it and just wait a moment for your project to load.
 

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#17
For that you have to see this step:
After you made your first custom part and decided to export it to see how far you can break the game into breaking either SFS space-time fabric or destroy your own computer (which will not happen I think), you will need to export it on a .pack file format.
For that you will need to right click on your project folder, inside of the mod folder you're using and then click on: Create - Pack Data, then you will have to fill that pack data with some things, like, mod name, version, image (optional), now the other thing that what you will also need to export your mod, you will need of a custom assetbundle, for that click on the custom part you made (don't open it) and you will see on the bottom a AssetBundle thing, click on it and then click on New and then just name it to whatever name you want, however you have to be careful with the amount of characters used and things like that, for example, some that I use are: sfs_cet1 (custom engines 1) and sfs_dah_ksp1.

Now on the top of your Unity project, you will see a button named just SFS, on that you will see another button named Build Pack, click on it, in the Data argument, click on it and then select the Pack Data you previously made, then on the Asset Bundle Label, click on it and select the custom asset bundle you previously made.
After that just fill the Output File name with the name of your mod and the version if you want.
On the build platforms just click on Windows (MacOS if you have the previously mentioned Mac Compiler Module), click on build mod, you will see a window appear after that, you can just ignore it, close or click on the cancel button, the mod will then be built.

Now to find the mod in the .pack file format, you will need to search on the file explorer of your computer and search for the modbuilder folder, this is usually the path you will find it:

C:\Users\"user"\Downloads\Spaceflight-Simulator--ModdingToolkit-main\Modding Toolkit\Assets\ModBuilder

After you have found it, just select your custom part pack that is the one with the .pack format and put it on your SFS custom parts folder.
You may have seen other file on the modbuilder folder after you built the mod, that file is a file on a .pack.meta format and is basically just garbage, you can even delet it.
This step can look a bit big but it's just because I try to explain this step with a bit of detail. You will see that it's actually simple after you do it :)
 

ilikespace

Planet editor
Recruit
Hot Stuff
Space Glider
Swingin' on a Star
Planet Sculptor
Atlas
Voyager Quest
Floater
#18
Thats my problem
I cant find the project folder
Is it inside the modding toolkit?
 

Dahzito

Amateur Astronomer | Future Astrophysicist
Staff member
Moderator
Ace
Modder
Deja Vu
Hot Stuff
Space Glider
Swingin' on a Star
Moon Maker
Atlas
#19
Thats my problem
I cant find the project folder
Is it inside the modding toolkit?
Oh, the modbuilder folder?
You cannot find it in this path?
C:\Users\"user"\Downloads\Spaceflight-Simulator--ModdingToolkit-main\Modding Toolkit\Assets\ModBuilder
I'm not at home right now so I cannot really check it, but maybe right click on a prefab and select the See in Folder option or something like that, after that try to go all the way back until you reach a part where you see the DLLs and Resources folders for example, that supposedly is on the folder which should be the "Spaceflight Simulator Molding Toolkit" and then try to find the Modbuilder or Modding folder.
When I get back home I'll try to check this if possible.
 

ilikespace

Planet editor
Recruit
Hot Stuff
Space Glider
Swingin' on a Star
Planet Sculptor
Atlas
Voyager Quest
Floater
#20
Oh, the modbuilder folder?
You cannot find it in this path?

I'm not at home right now so I cannot really check it, but maybe right click on a prefab and select the See in Folder option or something like that, after that try to go all the way back until you reach a part where you see the DLLs and Resources folders for example, that supposedly is on the folder which should be the "Spaceflight Simulator Molding Toolkit" and then try to find the Modbuilder or Modding folder.
When I get back home I'll try to check this if possible.
Thanks ill try it tomorrow
 

ilikespace

Planet editor
Recruit
Hot Stuff
Space Glider
Swingin' on a Star
Planet Sculptor
Atlas
Voyager Quest
Floater
#21
Theres no folder there related to mods
IMG_20240827_094019_482.jpg Im at this step i cant export it
This is how my assets folder looks like now IMG_20240827_094737~2.jpg
 
Last edited:

ilikespace

Planet editor
Recruit
Hot Stuff
Space Glider
Swingin' on a Star
Planet Sculptor
Atlas
Voyager Quest
Floater
#22
Ok i made it, exported it, it showed up in the modloader but its nowhere to be seen in the build view