Adding a custom layer

Our mechanic relies on raycasting to detect obstacles. Rather than just assuming every single object is an obstacle, we specifically use a layer named Obstacles and filter out everything else. This is not a default layer in Unity, so we have to set it up manually. The sample project already has this set up for you, but if you wanted to add your own layer, you could access the layer setup window in two different ways. The first is through the menus—Edit | Project Settings | Tags and Layers—and the second method is by selecting the layer dropdown in the hierarchy and selecting Add Layer....The following screenshot shows the menu's location in the upper-right corner of the inspector:

Selecting the Tags and Layers menu ...

Get Unity 2017 Game AI Programming - 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.