Let's start with our cucumber count:
- In the Hierarchy panel, select HUD_Canvas | Cucumber_Count
- In the Inspector panel, click the Add Component button
- Select New Script and name the script CucumberManager
- Edit the script
With the script open, make the necessary modifications to match the script provided, as follows:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CucumberManager : MonoBehaviour { public int currentCucumberCount; Text Cucumber_Count; public GameObject[] cucumbers; void Awake () { Cucumber_Count = GetComponent<Text> (); currentCucumberCount = 0; } void Update () { cucumbers = GameObject.FindGameObjectsWithTag ...