Next up, we’ll make a decorative buildable - the Plantpot of Knowledge,
a monument to your progress in the tutorials thus far.
A buildable is simply anything you will be able to place with the buildgun.
Even if it is just a simple foundation or fence, it is still an
Like items, buildables have descriptors to define their names and descriptions, but they also have an actor representation to act as the structure in the game world. There’s also a hologram which controls its placement. We don’t need a conveyor mesh for our building, since our buildings probably shouldn’t be moving around as items on conveyor belts. However, we’ll definitely still want a mesh for our building’s appearance in-game.
To stay organized, we’ll create a separate folder for each of our buildables to hold their textures, meshes, and so on in one place. Create new folder called "Buildables" in your mod’s root folder, then create another folder for our first Buildable. Let’s call it "DocBuild".
Next, create a blueprint of type
FGBuildable with f.e. the name "Build_DocBuild" inside your folder. This is the actual building object in which the model and factory logic are defined, among other things.
Now we need to populate the buildable description by simply filling the default values.
M Hologram Class to
FGBuildableHologram, which will cause the
FGBuildable to automatically find the hologram by itself.
M Display Name with something like "Doc Buildable" and
M Description with "An example building that showcases the MI_Factory_Base_01 material.".
Holograms control how buildings get placed. Later on, you can write your own to allow upgrading buildings or to have snapping functionality. You can learn more about how holograms work on the Buildable Holograms page.
As you can see in the
Components pane in the top left, the actor already contains a few components. But not any visuals, so, now add a new static mesh component in the center of the viewport. The build gun uses the origin when targeting the mesh to be built or snapped.
You can use this example Mesh, the Plantpot of Knowledge, for your buildable.
This Actor is also where you can define the snapping area and the clearance area, but we won’t do that for now. Look to other machines and examples for inspiration as there are several relevant settings to make those behaviors work correctly.
We want to make our buildable paintable, meaning, able to be painted it with the paint gun. Because the
FGBuildable-class already provides a basic implementation for that, we just need our buildable’s mesh to use the
MI_Factory_Base_01 material. The provided example mesh already provides a proper UV map for said material, so you will not need to edit the UVs of the provided mesh. You will need to do so for your own models. More info on the materials already in the game can be found at Main Materials documentation page.
You must ensure that the materials of the Mesh and Buildable are set to point to a material called
Content/FactoryGame/-Shared/Material. If this does not exist, create a placeholder material in its place, and it will point to the correct texture within the game.
More than one
Similar to how we created a descriptor for our item, we now need to create one for our buildable of type
Simply add a new Blueprint of type
FGBuildingDescriptor to the same folder as the buildable itself and call it f.e. "Desc_DocBuild".
The building descriptor is very similar to the item descriptor - it even derives from it. It comes with a few extra fields, such as a
FGBuildable-Class reference (set this to your
Build_DocBuild actor) and some Build-Category stuff that you can set up as you see fit.
Just like our item, it requires an icon file. You can use this example as the icon.
You should also add an appropriate subcategory in the
m Sub Categories field for your building.
Make sure you use
To define how our building is constructed we will use an
just like we did for our custom item.
Create a new FGRecipe asset and set ProducedIn to
then add Ingredients entries to define the cost of constructing the building.
The Product field should contain exactly one entry -
the FGBuildingDescriptor asset you just created for your buildable.
That’s it! You don’t need to register anything else. When the recipe gets loaded, everything else also gets loaded and the buildable in the save file has soft references to the classes, and if they get loaded also the classes like our newly created buildable get loaded.
If you load up the game now, you should be able to build the Doc Build in game, but it is purely an object that sits there and exists. You should be able to paint it with the paint tool, and it should look roughly like it does in the icon image.
Make sure that your building has an instanced static mesh component and that a mesh is assigned to it.
Check in both the Buildable’s mesh component the mesh’s own settings that the correct Factory Inst texture is selected.
Make sure the FGBuildingDescriptor has a category and sub-category set
BP_BuildGunis in the producers list of the FGRecipe
Make sure that you have purchased a schematic that unlocks the recipe you defined for your building
The crash message will likely contain
You forgot to assign a hologram class in the FGBuildable - the default is
None, which leads to this crash.
If something went wrong, feel free to contact us on the Discord for help.