person-to-doorRoom Environment

Learn how to create environments that work with this template.

Preparation

Before you begin, make sure that you have one or several environment prefabs that you plan on using. If you want to use the provided environments, or don't need any for now, you can skip this step.

Environment Components

This project uses navmesh for navigation, so it's important to have your Rooms set up properly.

Ground

First things first, make sure that the ground object you are using has these things:

  1. Collider component attached and configured to your ground.

  2. Tag and Sorting Layer set to Ground.

circle-check

Walls

The wall setup is a bit different. Make sure that all of your wall objects have the following settings:

  1. Collider and Nav Mesh Obstacle components are attached and configured to your desired sizes.

circle-info

Configure all the options for Nav Mesh Obstacle as on the screenshot below.

  1. Tag set to Wall and Sorting Layer set to Obstacle

Obstacles

Obstacles are configured the same as walls, with one exception - Tag should be set to Obstacle

Exit

If you want your room environment to have an exit, you will need a special prefab for it.

Let's take a look at an exit prefab. Go to Assets/The Archer/Prefabs/Prop/Chamber/Chamber Exit.prefab

Exit Prefab consists of 3 main components:

  1. Parent Object with a script and a collider

  2. Opened Visuals

  3. Closed Visuals

The logic of this structure is next:

  • While in gameplay, the exit displays closed visuals - energy field in this case.

  • And at the end of the Room visuals swap to opened - explosion VFX that simulates the field's breaking.

Exit Setup

To set up an exit prefab, create a structure as described above - a parent object, and 2 child objects with appropriate visuals inside.

The parent object should have several things:

  1. Room Exit Behavior script attached and configured as follows:

  2. Box Collider (or other 3D Collider) with appropriate size. This collider will detect the player entering the exit. Make sure to set it to Trigger as shown below.

  3. Sorting Layer is set to Room Exit

Environment Prefab

For the ease of use we recommend assembling one or several prefab for your Rooms (Environments).

Let's take a look at the provided prefab. Navigate to Assets/The Archer/Prefabs/Prop. There you will find several folders with prefabs. Open the Chamber folder and select and open Chamber Env.prefab

When opened, it should look like this:

At its core, this prefab consists of the mentioned objects: Play Field (Ground), Wall Colliders, and Exit.

The rest is purely decorative and should depend on the style you are going for.

In this case, there are no obstacles placed beforehand, since this environment will be reused. You can also make a different prefab for each room, but reuse is recommended to save on memory for both editor and build.

Last updated