Collecting cherries from trees

In this section, we will make the necessary adjustments to our game objects and script functionality that enable the collection of cherries from cherry trees. More specifically, we will create the following gameplay:

  • Detect collisions of Cucumber Man and cherry trees
  • Simulate collection of cherries
  • Update inventory and HUD with cherry count

Before we get started, you should open your Unity game project. Alternatively, you can download the Starting-Chapter-10 Unity project available from the publisher's companion site.

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.