Beetle patrol

Beetles in our game will search for cucumbers within the sandbox area. In this section, we will write a script to manage their patrol. Let's take some preparatory steps.

We will get started by creating a character controller for our Beetle prefab. Here are the steps:

  1. In the Project panel, select Assets | Prefabs and click on the Beetle prefab
  2. In the Inspector panel, click the Add Component button
  3. Select Physics | Character Controller
Be sure that you add the character controller to the Beetle prefab, not a beetle that you have in your scene.

We do not need to make any changes to the default character controller, but we do need to have one. 

Next, let's make things easy on us and create some temporary containing walls for the ...

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.