> For the complete documentation index, see [llms.txt](https://cowsinss-organization.gitbook.io/inventory-pro-add-on-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsinss-organization.gitbook.io/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingui.md).

# CraftingUI

{% hint style="info" %}
`CraftingUI` inherits from [TradeUI](/inventory-pro-add-on-documentation/content/03.-content/03.6-others/03.6.1-trade-hub/tradeui.md)
{% endhint %}

CraftingUI displays all available items to craft.  Crafting UI is enabled on interacting with the Crafting Bench, and it´s disabled when leaving the Crafting Bench.

### CRAFTING UI

* <mark style="color:purple;">craftButton:</mark> Button that contains a Recipe to craft. Refer to [CraftButton ](/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingbutton.md)for more information.
* <mark style="color:purple;">ingredientPrefab:</mark> IngredientUIIcon that defines an ingredient for the Recipe of the highlighted CraftButton
* <mark style="color:purple;">ingredientContainer:</mark> Ingredients Prefabs will be instantiated inside ingredientContainer

{% hint style="info" %}
The rest of properties are part of [TradeUI](/inventory-pro-add-on-documentation/content/03.-content/03.6-others/03.6.1-trade-hub/tradeui.md).
{% endhint %}

### Functions | CraftingUI.cs&#x20;

> <mark style="color:green;">UpdateSelectedUI(Recipe\_SO, int amountToCraft)</mark>
>
> Highlights the current recipe and displays information about it: Name, result, ingredients, etc...
>
> * <mark style="color:purple;">recipe:</mark> Recipe\_SO to display all information about.
> * <mark style="color:purple;">amountToCraft:</mark> Amount to display on the UI. This needs to match the real amount to craft to [Crafting Processes](/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingprocess.md) and UI are up-to-date.

> <mark style="color:green;">UpdateIngredientDisplay(Recipe\_SO, int amountToCraft)</mark>
>
> Updates the Ingredient Displays of a highlighted Recipe based on the desired amount of items to craft.
>
> * <mark style="color:purple;">recipe:</mark> Recipe\_SO to display all information about.
> * <mark style="color:purple;">amountToCraft:</mark> Amount to display on the UI. This needs to match the real amount to craft to [Crafting Processes](/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingprocess.md) and UI are up-to-date.

> <mark style="color:green;">UpdateCraftingProcess(CraftingProcess craftingProcess, float progress)</mark>
>
> Updates a Recipe Button progress.
>
> * <mark style="color:purple;">craftingProcess:</mark> Crafting Process to update.
> * <mark style="color:purple;">progress:</mark> Takes values from 0 to 1.&#x20;

> <mark style="color:green;">GetCraftButton(Recipe\_SO recipe)</mark>
>
> Returns the Craft Button based on its recipe. Returns a [CraftButton](/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingbutton.md).
>
> * <mark style="color:purple;">recipe:</mark> Among all buttons, it returns the button that contains this recipe.

> <mark style="color:green;">GetCraftingProcess(Recipe\_SO recipe)</mark>
>
> Returns the Crafting Process based on its recipe. Returns a [Crafting Process](/inventory-pro-add-on-documentation/content/03.-content/03.1-crafting/craftingprocess.md).
>
> * <mark style="color:purple;">recipe:</mark> Among all Crafting Processes, it returns the one that contains this recipe.

> <mark style="color:green;">CraftItem(Recipe\_SO recipe, int craftAmount)</mark>
>
> Starts the Crafting Process for a Recipe based on the amount to craft.
>
> * <mark style="color:purple;">recipe:</mark> recipe to craft.
> * <mark style="color:purple;">craftAmount:</mark> Amount to craft.

> <mark style="color:green;">IsCrafting(Recipe\_SO recipe)</mark>
>
> Returns true if the passed recipe is being crafted. Returns a boolean.
>
> * <mark style="color:purple;">recipe:</mark> recipe to check crafting process.
