Testing navigationÂ
To test that our navigation mesh and settings are working correctly, we'll create an object for the chick to seek in the environment, using pathfinding and steering to reach the goal. To implement this behavior, we'll also need to write a new script:
- Select GameObject | Create Empty from the Application menu to create a new empty object, which will act as a target object.
- Name the new object
Destination
. - Assign it a Gizmo icon to make it visible in the viewport by clicking on the cube icon at the top-left of the Inspector and then choose an icon representation:
- Next, create a new C# script file called
FollowDestination.cs
:using UnityEngine; using UnityEngine.AI; [RequireComponent(typeof(NavMeshAgent))] public class FollowDestination : MonoBehaviour { Â Â Â Â public Transform Destination = null; Â Â Â Â private NavMeshAgent ThisAgent = null...