Updating the HUD with lives remaining

In the previous section, we modified the CucumberManManager script to track the number of lives our player has remaining and, when none were left, the appropriate animation was played. In this section, we will continue modifying the CucumberManManager script to update the HUD with the number of lives remaining.

We only need to modify the CucumberManManager script's Update() method. The completed Update() method is provided here with an explanation of the changes made:

     void Update () {          if (collectingCherries) {             if (tempCurrentCherryCount ></span>= 60) {                 currentCherryCount = currentCherryCount + 1;                 tempCurrentCherryCount = 0;                  _ptsManager = GameObject.Find                  ("Score_Value").GetComponent&lt;PointsManager ...

Get Getting Started with Unity 2018 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.