Crafting System¶
This page will help you to create/remove recipes/categories. Any detailed information about the system available in the system's documentation (in the code) or Unity Editor's tooltips. But you can ask any question about the system in Discord - just ping Lizurt#4269.
How to...¶
How to create a new crafting recipe¶
- Open the Unity Editor
- Follow the path: /Assets/ScriptableObjects/Crafting/Recipes/
- Find a necessarry category to put a new recipe into.
- RMB -> Create -> ScriptableObjects -> Crafting -> CraftingRecipe
- Give the new recipe a name.
- Press the "Add to the singleton if necessary" button.
- Edit your new recipe freely(tooltips will help you).
- Add the opportunity for a player to learn this recipe.
- You can add the recipe to the default known recipes list in the PlayerCrafting component of the Player_V4 prefab.
- You can add the recipe to a recipe book.
How to delete a crafting recipe¶
- Open the Unity Editor
- Follow the path: /Assets/ScriptableObjects/Crafting/Recipes/
- Find a necessarry crafting recipe.
- Open the recipe.
- Make sure to remove this recipe from any ways to learn this recipe.
- You can skip this step - unit tests will help you to find missing asset references.
- You can check Player's PlayerCrafting component.
- You can check recipe books.
- Press the "Prepare for deletion" button.
- Now you can safely delete this recipe.
- For example, RMB on the crafting recipe -> Delete
How to create a new crafting category¶
- Open /UnityProject/Assets/Scripts/Systems/CraftingV2/RecipeCategory.cs
- Add a new category enum.
- Open the Unity Editor.
- Open the path: /Assets/ScriptableObjects/Crafting/Categories/
- RMB -> Create -> ScriptableObjects -> Crafting -> CategoryAndIcon
- Choose RecipeCategory (the enum that was added at step #2).
- Choose CategoryIcon (usually they're located in /Assets/Recources/UI/CraftingCategoryIcons/).
- Follow the path: /Assets/Prefabs/UI/Tabs/Recources/Crafting/CategoryButtons/
- Press RMB on the _BaseCategoryButton -> Create -> Prefab variant.
- Choose CategoryAndIcon that was created at the step #5.
- Follow the path: /Assets/Prefabs/UI/Tabs/Recources/Crafting/CraftingMenu.prefab
- Add your new category button to the CategoryButtonsPrefabs list (in the CraftingMenu script).
How to delete a crafting category¶
- Open the Unity Editor.
- Make sure that there are no recipes that use this recipe category.
- Usually these recipes are located in the /Assets/ScriptableObjects/Crafting/Recipes/yourcategory
- Follow the path: /Assets/Prefabs/UI/Tabs/Recources/Crafting/CraftingMenu.prefab
- Remove the category from CategoryButtonsPrefabs list (in the CraftingMenu script).
- Follow the path: /Assets/Prefabs/UI/Tabs/Recources/Crafting/CategoryButtons/
- Find a necessary category button (look at the CategoryAndIcon field in the CategoryButtonScript component).
- Delete the category button.
- Follow the path: /Assets/ScriptableObjects/Crafting/Categories/
- Find a necessary CategoryAndIcon (look at the RecipeCategory field).
- Delete the necessary CategoryAndIcon.
- Follow the path: /Assets/Scripts/Systems/CraftingV2/RecipeCategory.cs
- Remove the necessary recipe category enum value.
How to create a new recipe book.¶
- Open the Unity Editor.
- Follow the path: /Assets/Prefabs/Items/Bureaucracy/RecipeBook/
- RMB on the _Base_RecipeBook -> Create -> Prefab variant.
- Add recipes to the ContainsRecipes list of the RecipeBook component.
- Optionally, add remarks, edit book's settings.
- Optionally, add the book on a map.
FAQ¶
The singleton has nulls or some recipes in the singleton have a wrong index. What should I do?¶
Don't worry, you don't have to manually fix the singleton or a recipes' index.
- Open the Unity Editor.
- Open the CraftingRecipeSingleton.
- Press the button "Remove nulls and fix recipes' indexes" below.
Reagents don't work as ingredients. What should I do?¶
Perhaps the ChemistryReagentsSO singleton has reagents with a wrong index. You also probably can notice an error in the console that says something about it.
- Open the Unity Editor.
- Open the ChemistryReagentsSO singleton.
- Press the button "Fix reagents' indexes" below.