O'Reilly logo

Unity AI Programming Essentials by Dan Violet Sagmiller, Curtis Bennett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

React AI

For this demo, we will duplicate the path-following behavior demo in React from Chapter 1, Pathfinding, and then update it to see some emergent behavior develop from it. We will need to complete the following:

  • Create a world with some walls
  • Create target markers in the scene
  • Create a script with a custom editor to find the targets
  • Create the behavior
  • Create NPCs and assign the behavior

Setting up a scene with React

To start out with, we will need a basic environment for characters to walk in. Create a plane, call it Floor, and add some cubes, shaping them into walls. These will need to be static so that Unity's navigation mesh can find them. Then, we'll need to select the floor and add the navigation mesh. If you've forgotten how to do any of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required