Links

Door and key systems

This tutorial will show you how doors work as well as a different system for making locked doors open such as picking up keys, collecting an item or pushing a button.
  • Press 'L' to bring up your asset library and select a door to your liking.
  • Place it down, select it and make sure it has the 'Door Behaviour'
  • Click 'Edit logic' button to see all the settings
You will see under 'Message Required' there are 2 messages. Interact and Trigger. Interact is default 'E' button that the player uses to interact with the world around them. Trigger is the default message of buttons. When a button is pushed it will affect the door. If you delete both these messages the door will not be able to open.
What if you want the door to only open when you collect a key?
  • Select the door and under the 'Door Behaviour', 'Message Required' have only 1 message. In our example we used 'key1' as a message.
  • Next bring out a key asset from your asset library.
  • Select it and add the 'Collectable Component'
  • Click the 'Edit Logic' button if it's displayed
  • Under 'Collect Message' changed it to 'key1'
When you test your game you should be able to collect the key which causes the door to open.