First Person Exploration Kit: Doorways and Levels Overview



Doorways

The FPEDoorway component provides the means to create doorways between Unity Scenes

FPEDoorway View

Overview

Doorways are used to create a way for the player to change scenes. They are comprised of a Box Collider (Trigger) to detect player exit, as well as a child transform to act as the entrance. When the player exits using a Doorway, the specified scene is loaded, and the player is placed in the entrance of the Doorway in the loaded scene

FPEDoorway Labeled

To create a new Doorway:

  1. Add a Cube to your scene
  2. Delete the Mesh Renderer and Mesh Filter from the cube, and check the Trigger check box on its Box Collider
  3. Add the FPEDoorway component (script) to the cube
  4. Add a child transform (Empty Game Object) to the cube
  5. Assign the new child transform to the Doorway Entrance Transform field in the inspector
  6. Scale the cube to be the required size (i.e. make sure it spans the required doorway or area where the player must go into to use the doorway
  7. Change the position of the Entrance Transform so that it does not overlap with the main yellow volume
  8. Change the rotation of the Entrance Transform so that its Z+ (blue arrow) is facing the direction "out" from the doorway. When the player is placed in the entrance, they will face the same way as the blue arrow.
  9. Assign the desired scene build index in the Connected Scene Index field in the inspector. This must match the Scene Build Index in the Build Settings. (e.g. A value of 2 will connect the doorway to the scene at build index 2)
  10. Lastly, if you want the game to automatically save the state of the scene the doorway is in (recommended in most cases), leave the Auto Save On Exit checkbox checked.

A completely configured Doorway (per the steps above) is shown here:

FPEDoorway Labeled