You can use the Lock device to customize the state and accessibility of a door. Locking and unlocking can be triggered by player actions or by other devices.
This device only works with assets that have a door or gate attached.
Locking a Door
The most basic use for the Lock device is — you guessed it — locking a door!
Connect the lock to a Button device for easy toggling between locked and unlocked states.ndefined
Devices Used
1 x Lock device
1 x Player Spawner device
1 x Button device
Set Up the Devices
Place the Brick House prefab.
Place a Player Spawner device in front of the door.
Place a Lock device on the door panel. Make sure the light on the lock is blue, which indicates that it is connected to the door.
Place a Button device next to the door.
Customize the button as follows:
Option Value Interaction Text
Toggle Lock
Configure the following event on the button so that it toggles the lock when pressed.
Event Select Device Select Function On Interact
Lock Device
Toggle Locked
You now have the basic functionality for a locking door!
Design Tip
The Lock device can very easily be connected to a Conditional Button device to give the added requirement that aplayer possess the correct key. The key can be anything: an actual key, a specific weapon, a fish, or anything else you can imagine.
Escape Room Exit
Locks are a core part of any escape room or puzzle game where players must solve a puzzle to get out of an area. In this example, you’ll set up a basic puzzle that unlocks the player’s exit when solved.
Devices Used
1 x Lock device
1 x Player Spawner device
1 x HUD Message device
1 x Audio Player device
4 x Switch devices
Set Up the Play Area
Place the Castle Cellar prefab.
Place a Player Spawner device inside the building.
Customize the player spawner to not be visible in-game:
Place a lock on each of the two doors leading outside.
Place a HUD Message device.
Customize the HUD message:
Option Value Message
Flip all three levers to escape!
Show on Round Start
On
Time from Round Start
Instant
Text Color
White
Place an Audio Player device. (In later steps, you will configure this to play a sound effect when the puzzle is completed.)
Customize the audio player:
Option Value Description Enable Spatialization
Off
Makes sure the audio pan is equal regardless of where the player is.
Enable Volume Attenuation
Off
Makes sure the audio volume is equal regardless of where the player is.
Configure the Switch System
Next, you’ll set up a basic logic system that will be able to tell whether all of the puzzle switches are on or not.
Place a Switch device. This will be the master switch.
Customize the switch:
Option Value Visible During Game
No
Sound
Disabled
Allow Interaction
No
Place another switch. This will be the first of the puzzle switches. Customize the puzzle switch as follows:
Option Value Device Model
Ancient Lever
Configure the following event on the puzzle switch so that the switch forces the master switch to match its value. (You will configure the master switch to check each puzzle switch in a future step. For now, the puzzle switch will turn the master switch Off when checked.)
Event Select Device Select Function On Turned Off
Master Switch
Turn Off
On Check Result Off
Master Switch
Turn Off
Configure the following event on the master switch so that when turned on, it checks the puzzle switch, unlocks the doors, and plays the audio player. When turned off, it will relock the doors and stop the audio player, which will keep everything working when the master switch is quickly turned on and off by the puzzle switches.
Event Select Device Select Function On Turned On
Lock Device 1-2
Unlock
On Turned On
Audio Player
Play
On Turned Off
Lock Device 1-2
Lock
On Turned Off
Audio Player
Stop
Duplicate the puzzle switch two more times and place them strategically around the building. Duplicating the device will ensure that they retain the correct direct event bindings.
You now have the basic functionality for an escape room using locks!
Design Tip
To add some more tension to a puzzle like this, try giving the player some type of time limit. That could be as simple as a Timer that locks them inside permanently if they don’t complete the puzzle in a certain amount of time. Or, think of more creative ways to limit the player, like slowly doing damage to them while inside or filling the room up with water!
Build a Door Parkour Game!
When combined with other devices like the Timer, the Lock device can produce very interesting results. In this example, you’ll create a parkour map using opening and closing doors as a primary mechanic!
Devices Used
8 x Lock devices
1 x Player Spawner device
1 x Prop Mover device
1 x Bouncer Gallery device
1 x Damage Volume device
1 x Timer device
1 x Trigger device
1 x End Game device
Set Up Your Parkour Island
Begin by setting up your parkour island using floors from the Colossal Coliseum Floor & Stair Gallery and doors from the Colossal Coliseum Wall Gallery. While setting up the island, test out the jumps yourself to dial in the distances between objects! If you’re confused about how things should look, see the video above.
Place a floor floating high up in the air.
On the starting floor, place a Player Spawner.
Customize the Player Spawner so Visible in Game is set to Off
In front of the starting platform, place a few floors with doors on either side.
In front of this platform, place another floor up and slightly to the left.
Place a Prop Mover on this platform. Make sure that the device appears green while placing, which indicates that it is connected to the platform. Rotate the Prop Mover to point to the right.
Customize the Prop Mover:
Option Value Speed
4.0 Meters/Second
On Player Collision Behavior
Continue
Player Damage on Collision
0.0
Path Complete Action
Ping Pong
In front and below this platform, place a bouncer from the Bouncer Gallery device.
Customize the Bouncer:
Way above the Bouncer, place another platform with a door in front.
Create a path of four horizontal doors with gaps between them, each one raised slightly from the last. Rotate them differently to create some variation.
After the last door, place another platform blocked by a door. This will be the ending point for the parkour course!
Place a Damage Volume on the ground below the parkour course.
Customize the Damage Volume:
Option Value Zone Depth
100
Zone Height
Minimal
Damage Type
Elimination
Configure the Locks
Place a Lock device on the first door.
For the lock, set Visible During Game to Off.
Place a Timer device and customize.
Option Value Start at Game Start
On
Can Interact
No
Completion Behavior
Restart
Visible During Game
Hidden
Timer Color
White
Show on HUD
No
Configure the following event on the timer so that each time it completes, it will switch the state of the door from open to closed or vice versa.
Event Select Device Select Function On Success
Lock Device 1
Toggle Opened
Duplicate the lock and place duplicates on each door throughout the course. Duplicating the devices ensures that they retain the correct direct event bindings.
Set Up the Game End
Right after the final door on the ending platform, place a Trigger device on the ground.
Customize the trigger so Visible in Game is set to Off:
Place an End Game device somewhere where the player won’t be able to see it, and customize it with a Course Completed! victory callout.
Configure the following event on the Trigger device so that when the player reaches it, the game ends.
Event Select Device Select Function
Modify Island Settings
Make the following modifications to the island settings.
Go to Island Settings > Player.
Under Locomotion, change Glider Redeploy to Off.
Under Equipment, change Start With Pickaxe to No.
Go to Island Settings > Mode.
Under Spawning, change Respawn Time to 1 Second.
You now have a working parkour game using locks!
Design Tip
This example uses only one timer to control all of the locks, but consider having more timers to control each lock individually. This would give more control over each door, allowing you to set some to be quicker than others!