Coconut trails

Next we'll add some flair to our coconut shy game by adding light trails to our coconut prefabs. By doing this, when the player throws them, they'll see a trail of light following the trajectory of the projectile, which should give a nice visual effect.

Editing the Prefab

To implement this change, we'll need to return to our coconut prefab from Chapter 6, as the Trail Renderer component we will use must be attached to this object. Open the Prefabs folder in the Project panel, and locate the Coconut Prefab asset. Drag it into the scene so that we can work on it assets can be worked on directly from their location in the Project panel, but in order to preview and test the effect we're creating, it is best to drag them to the scene, ...

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.