Factory Builder Template

The template that will help you to quickly create your own factory builder/simulation game! You can easily add new items, crafting recipes, put your own models and create custom machines!


Please note included models are basic and are meant to be placeholders to showcase how the template works


Features:

-Abstract framework - every machine type inherits from the same base class Machine.cs making code cleaner and easier to work with

-Inventory system with items as scriptable objects - you can easily create new items in Unity inspector and add inventory to any game object by attaching just one script

-7 machine types ready to be used - smelter, crafting machine, storage container, miner, conveyor belt, conveyor belt splitter, conveyor belt connector

-Save/Load system - all machines can be serialized/deserialized into/from JSON file

-Machines use Unity Events to communicate their state allowing easy integration with models, particles, and custom scripts f.e. turn on smoke particles when smelter is working, play crafting animation during the crafting process (see included examples) without any coding!

-UI integration - every machine has its own corresponding UI panel, f.e. crafting machine has a custom UI panel where you can change selected crafting recipe, see required ingredients and recipe products

-Building system - a simple player tools system allowing players to place machine's prefabs freely or in grid mode to then connect them with conveyor belts

-Custom loop for machines updates - a loop that ticks at a lower frequency than the game update to save on performance

-First-person player controller

-Compatible with all Render Pipelines - this template is all about code and all materials use standard Unity shaders which are upgradable (instruction included in the documentation)

-Compatible with all platforms*

-Full source code included


Included Machines:

-Conveyor belt - made using line renderer, renders items using instancing when possible

-Splitter and connector - connect or split conveyor belts to create advanced transportation systems

-Miners and ores - base products like coal, iron ore can be mined using miners from ores

-Smelter - transport mined ore to the smelter and turn it into a bar

-Crafting machine - configurable to have as many inputs and outputs as you need, turn the smelted bar into the next product on the assembly line

-Storage container - store crafted items in containers


Included Models, Items, and Prefabs:

-Package includes model and prefab for every machine type and item (all visible on the last screenshot), please note these models are basic and are meant to be placeholders to showcase how my template works

Included scriptable objects:

-Items: coal ore, iron ore, iron bar, iron rods, iron plate, iron frame (+UI icons)

-Crafting recipes: iron bar recipe, iron rod recipe, iron plate recipe, iron frame recipe


Included Demo:

-Demo consists of an assembly line example that starts from mining ore and ends on crafting iron frames (coal + iron ore -> iron bar -> iron rods and iron plates -> iron frame)


Experimental features:

-Running machines logic on a separate thread to save performance


Documentation and downloadable windows demo


*On some platforms saving to text file may need modification if System.IO.File.WriteAllText method or Application.persistentDataPath is not supported (the biggest platforms support these)