Making the minigame

To put into practice what we have just looked at, we'll create a coconut shy game that ties into our access to the outpost. By playing the game, the player will be rewarded with the final battery they require to charge the outpost door.

As we have already set up the battery charge element of the game, we simply need to remove one of the batteries from the existing scene, leaving the player with one less.

Select one of the objects called battery in the Hierarchy panel, and then remove it with Command + Backspace (Mac) or Delete (PC).

Creating the coconut prefab

Now that we have learnt about instantiation, we'll begin our minigame by creating the object to be thrown, that is, the coconut.

Go to Game Object | Create Other | Sphere ...

Get Unity Game Development Essentials 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.