Crafting System. How to implement it?

Hey!
I’ve been trying to implement the crafting system which was described by Adir Baron in the blog, but I can’t make it work in the UI.

I’ve been using a copy of the inventory UI for the test purposes, where I assigned CraftingUI script to the inventory items (renamed it to crafting items) and I renamed inventoryslot to craftingslot, inside of which I changed InventorySlotUI to CraftingSlotUI script
Also I made a test object which acts as a crafting station with a ShowCraftingUI script.

Now the issue is when I try to interact with the crafting station I get an almost empty screen - It’s showing the contents of the craftingUI prefabs, but they are displayed wrong. Also it looks like that the crafting slot is not showing the item from the recipe.
It’s most likely that I am using a wrong “Recipe Prefab” object, because I don’t understand what it is supposed to contain. Right now an empty object is assigned to it.

Here are screenshot of the scripts and their content in the inspector, code for the scripts is identical to the ones used in the blog

Crafting items (inventory items) - image
Crafting table -
image
Crafting slot -

Crafting recipe scriptable object contains only 1 test recipe - one hat to create one sword

It would be easier to remake the UI in my opinion, but how to do it properly?

This is a case where I would definitely remake the UI… Something where each item you could make is a row with 1-3 “requirement” slots and a result slot.
Then when you fill the RecipeSlotUI, for each ingredient, find the next available ingredient slot (I recommend no more than 3 ingredients or you start to confuse people) and the resulting object in the final slot.

Privacy & Terms