private void OnEnable()
 {
     if (recipreController != null)
     {
         if (name == "Chopper")
         {
             currentUpgradeRecipe = recipreController.LastChopperUpgrade;
         }
         else if (name == "Miner")
         {
             currentUpgradeRecipe = recipreController.LastMinerUpgrade;
         }
     }
 }
 public void GetRecipe()
 {
     if (recipreController != null)
     {
         if (name == "Chopper")
         {
             currentUpgradeRecipe = recipreController.LastChopperUpgrade;
         }
         else if (name == "Miner")
         {
             currentUpgradeRecipe = recipreController.LastMinerUpgrade;
         }
     }
 }
    //[SerializeField] private UpgradeRecipes currentRecipe;
    private void OnEnable()
    {
        UpgradeRecipes currentRecipe = GetComponent <AddRecipeOnScript>().CurrentUpgradeRecipe;

        if (currentRecipe == null)
        {
            currentRecipe = GetComponent <AddRecipeOnScript>().CurrentItemRecipe;
        }
        bool allResourcesAvailable = false;

        if (currentRecipe != null)
        {
            byte countAvailable = 0;
            for (int i = 0; i < currentRecipe.RecipesItemsID.Length; i++)
            {
                var child     = transform.GetChild(i);
                var currentID = currentRecipe.RecipesItemsID[i];
                //set sprite
#if UNITY_EDITOR
                DirectoryInfo directoryInfo = new DirectoryInfo(Application.streamingAssetsPath + "/ItemsIcons");
                print(directoryInfo);
                FileInfo[] allFiles = directoryInfo.GetFiles("*.*");

                foreach (var file in allFiles)
                {
                    if (file.Name.Contains(SQLiteBD.ExecuteQueryWithAnswer($"SELECT pathToSprite FROM Items WHERE itemID = {currentID}")))
                    {
                        StartCoroutine(LoadItemIcon(file, i));
                    }
                }
#endif
#if UNITY_ANDROID
                //DirectoryInfo direcrotyInfo = new DirectoryInfo(Application.persistentDataPath);
                //DirectoryInfo direcrotyInfo = new DirectoryInfo()
                StartCoroutine(LoadItemIcon(Application.streamingAssetsPath + "/ItemsIcons", i, currentID));
#endif

                int             playerCount = int.Parse(SQLiteBD.ExecuteQueryWithAnswer($"SELECT ItemCount FROM PlayersItems WHERE itemId = {currentID} AND playerId = {GameController.PlayerID}"));
                TextMeshProUGUI childTMP    = child.GetChild(1).GetComponent <TextMeshProUGUI>();

                //set text color
                if (playerCount >= currentRecipe.RecipesCountItems[i])
                {
                    Debug.Log($"{gameObject.name} {countAvailable}//{currentRecipe.RecipesItemsID.Length}");
                    childTMP.color = Color.green;
                    countAvailable++;
                }
                else
                {
                    childTMP.color = Color.red;
                }
                if (countAvailable >= currentRecipe.RecipesItemsID.Length)
                {
                    allResourcesAvailable = true;
                }
                //Debug.Log($"{gameObject.name} {allResourcesAvailable}//{countAvailable}");

                childTMP.text = $"" +
                                $"{playerCount}" +
                                $"/{currentRecipe.RecipesCountItems[i]}";
                child.gameObject.SetActive(true);
            }
        }
        else
        {
            Debug.LogError("Not have a recipe");
        }
        if (allResourcesAvailable)
        {
            transform.GetChild(6).GetComponent <Button>().interactable = true;
        }
        else
        {
            transform.GetChild(6).GetComponent <Button>().interactable = false;
        }
    }
 private void OnDisable()
 {
     currentUpgradeRecipe = null;
     currentItemRecipe    = null;
 }