protected void ChangeRecipeDisplayed() { List <Dictionary <string, int> > recipeProgressList = new List <Dictionary <string, int> >(playerInventoryData.GetRecipeProgress()); RecipeController recipeToBeDisplayed = GetRecipeToDisplay(); recipeProgressList.Sort(closestToFinishFirst); GameObject dishImageForeground = gameObject.transform.GetChild(0).gameObject; dishImageForeground.GetComponent <Image>().sprite = recipeToBeDisplayed.GetRecipeImage(); int ingredientIterator = 0; int hasIngredientCnt = 0; foreach (Transform child in dishImageForeground.transform) { IngredientController currentIngredient = recipeToBeDisplayed.ingredients[ingredientIterator]; if (recipeProgressList[priority][currentIngredient.ingredient] != 0) { hasIngredientCnt++; } ingredientIterator++; } // only set the UI sprite if on a stacked UI element if (stackedDishTemplatesIncreasingCompletionRate.Count == 3) { gameObject.GetComponent <Image>().sprite = stackedDishTemplatesIncreasingCompletionRate[hasIngredientCnt]; } }