Adding doors to the scene
If you want to add a pair of doors to your level just place the prefab Door in your level, ensuring the arrow is aiming at direction the player will be looking when entering the room.
Each door has to be set as an Exit to each other on their respective SceneDoor component. If a door has an exit it’ll show a red line between the doors. If two doors have each other as an exit a green line will be shown connecting the doors.
Doors do not have any visuals by default. You can of course, add any model you want to represent the door and create prefab variants or other prefabs that contain the existing Door prefab with specific visuals.
Adding door transition animations
The engine supports transition animations between doors, these can be set on the SceneDoor component itself. The project has two example prefabs called DoorDefaultAnimation located in HorrorEngine/ExampleContent/Doors and LadderDownAnimation/LadderUpAnimation, located in the same folder. Any of these can be dragged & dropped onto the Animation field of the SceneDoor component.
Creating your own door transitions prefab
You can create your own door animations by doing the following. Please check existing transitions to see how it’s done:
- Create an empty prefab and add the BlackBox prefab inside. This will prevent the player from seeing any other parts of the scene. This is necessary since the door transition is played in the current scene (at a very remote position) where other elements are present (such as the character, enemies, etc..)
- Add the desired visuals to the scene in a way that they fit inside the BlackBox and optionally add a light that iluminates your scene accordingly.
- If your door visuals did not have an animation (and therefore no Animator component is present in the prefab yet). Add an Animator to the top level of the prefab and change UpdateTime to Unscaled Time.
- Add a DoorAnimation component to the same object that has the Animator and optionally assign the audio clip that will be played.
- Add an object called CM Door, with a CinemachineVirtualCamera component and set it’s priority to a high value such as 100
- In order to correctly see the camera view on the Game window, you might want to drop the prefab CameraSystem temporarily in your scene. This contains the MainCamera and the Cinemachine brain which will enable live preview during the animation.
- If your door didn’t have an animation clip. Create one in Unity using the Animation window and animate the door and the camera until the transition looks as desired.
- Add an event to the last frame of your door animation Animation that calls the function AnimEvent_Finish. This can be done from the Animation window or from the Mesh Inpector (Animation tab)
https://lh6.googleusercontent.com/TI7m5Oh3FT5HhWpX6225HmLLD4miqcB0DV3S7epXLea2705XLT2J89UWlFtcssHV3-hxzgbzhRmqxMtiP-Fmlz56vSqYxQtUzTibveK32qwsek3twGAsMtUqma4YO863HPkaotrGksqq4HbU_AB1xKCM3Ux3OpJYrV5e0XQ0UNjDDQ9DzqkpcpS2vQ
https://lh4.googleusercontent.com/BmcxxIL9ECZAXtzO4yFt6y7HgreL5ozIc3mhPlATqvAmctCbVf6maQtP405_ZoFH1JeN6ZTGVqvHLb9dFTGykXerVEeQeqFDUr6QOaWHw1kZcW7I67qDwX9dJlhApQFS4-MZbHZ_SN4LbB47gVDG7flk_EguvEKTZL-6KhJo2bBCiydbWyEZ5UsGlA
Door locks