# If my items I put in array == Recipe?

**URL:** <https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine, UE4-27, question\
**Created:** [February 16, 2022, 5:21pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822 "2022-02-16T17:21:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cooper\_Creves](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cooper\_Creves](https://forums.unrealengine.com/u/Cooper_Creves)\
**Post date:** [February 16, 2022, 5:21pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/1 "2022-02-16T17:21:42Z")

</div>

I’m trying to make a cooking game and I have no Idea how I would check. I have an array called Recipe, in all my items structure. I just dont know how I would check my Recipe, when I put an item in.

---

<div class="post-metadata">

**Author:** ![OmegaMinus1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/omegaminus1/32/252513_2.png) [@OmegaMinus1](https://forums.unrealengine.com/u/OmegaMinus1)\
**Post date:** [February 16, 2022, 6:21pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/2 "2022-02-16T18:21:39Z")

</div>

No matter the case of implementation it is simple add and compare.  
Use the array called like CurrentRecipe add the items required to be a complete recipe

When you add a item in games WorkingRecipe it should be empty array to start, so every time you add a item to WorkingRecipe then with foreach loop through items in CurrentRecipe and if all items are present in WorkingRecipe you have a match.

---

<div class="post-metadata">

**Author:** ![Cooper\_Creves](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cooper\_Creves](https://forums.unrealengine.com/u/Cooper_Creves)\
**Post date:** [February 16, 2022, 6:34pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/3 "2022-02-16T18:34:00Z")

</div>

Thank you for your reply! The only thing is, and I’m sorry if this is a stupid question, but the “If all items are present” bit between the Current Array and the Working Array. How would I check that?

---

<div class="post-metadata">

**Author:** ![Cooper\_Creves](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cooper\_Creves](https://forums.unrealengine.com/u/Cooper_Creves)\
**Post date:** [February 16, 2022, 6:43pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/4 "2022-02-16T18:43:06Z")

</div>

Nevermind I found out the quick answer to that.

> [@Compare Arrays for Similar Item](https://forums.unrealengine.com/t/compare-arrays-for-similar-item/83281/2):
>
> Make a For Each Loop (Array 1) In the loop: Make For Each Loop (Array 2) -\> Output Element Array 1 = Output Element Array 2 -\> return Found But this will probably kill the performance if the arrays are big, and if the Item at the end of an array is. Arrays probably support a “find” (in array) function - you could try this too - if existing.

thank you again. it all works.

---

<div class="post-metadata">

**Author:** ![OmegaMinus1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/omegaminus1/32/252513_2.png) [@OmegaMinus1](https://forums.unrealengine.com/u/OmegaMinus1)\
**Post date:** [February 16, 2022, 7:03pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/5 "2022-02-16T19:03:45Z")

</div>

Cool and yes that works but you don’t have to manual loop the seconded.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/c/7ac495eaec164a809ffb107454bafc54f04134e0.png)

---

<div class="post-metadata">

**Author:** ![Cooper\_Creves](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cooper\_Creves](https://forums.unrealengine.com/u/Cooper_Creves)\
**Post date:** [February 16, 2022, 7:06pm UTC](https://forums.unrealengine.com/t/if-my-items-i-put-in-array-recipe/498822/6 "2022-02-16T19:06:52Z")

</div>

Ya you right lol. this is much better. Thank you again for your time my man.
