Updating the physics settings
In the previous chapter, we included all the variations of enemies in the project and created a couple of scripts to spawn and update them. Now, we are going to expand enemy support by adding a custom layer for them and setting up the layer collision matrix and camera’s Culling Mask to use the new layer.
Let's start by creating the new layer:
- Click Edit | Project Settings….
- In the Project Settings window, select the Tags and Layers option from the left panel.
- Add the Enemy value to User Layer 9.
- Save the project.
The following figure shows the current custom layers that we have added so far to our project:
Figure 10.1 – Adding Enemy to the Layers settings
It is important that the Portrait, Unit, Plane, and Enemy custom layers are added to the corresponding User Layer. When setting a layer to a Culling Mask, for example, the Unity Engine uses User Layer as an index, and...