[Tutorial]Implementing Event Triggers for Door Opening Automatically in Horror Game Kit

Hello fellow creators,

I’m excited to share a tutorial guide on how to use event triggers in the Horror Game Kit to unlock a door when five collectable items are collected or activated in any order. :partying_face:

Implementing Edit mode settings

Door Configuration

  1. First, locate the Unlocked Door/Locked Door and Key smart asset in Packages > Horror Game Assets. Choose either one based on your needs.

  1. If the current smart asset’s door model meets your requirements, you can use it directly. If not, select the object with the Smart label and replace the model in the properties panel as needed, following the model replacement guide.

Collectable Item Configuration

  1. Similar to the door configuration, find the Collectable item smart asset in Packages > Horror Game Assets and choose to replace or not replace the collectable model as per your design.

  1. Once configured, the five collectable objects correspond to the five collectible assets in the scene, as illustrated in the figure below.

Trigger The Door Open Automatically

  1. Adding an Empty object from the Quick Create panel.

  1. Create a Counter and Event Trigger component for the Empty object.

Counter Component

Property Description
Notify Key Value Event Notifies when the count changes, e.g., from 1 to 5.
Key Value The target count. Set this to 5 for collecting five collectable objects, and enable the Notify KeyValue Event switch.

Event Trigger Component

Event Description
OnKeyValueReached Triggered when the KeyValue reaches the target count.
Action Description
OnKeyValueReached The specific behavior of the target object, such as the door opening.

  1. Create an Event Trigger component for the Collectable objects.

Event Trigger Component

Event Description
OnPickedUp Triggered when the target object is picked up.
Action Description
Increase Increase the Counter’s KeyValue by 1, e.g., from 0 to 1.

When the first collectable object is picked up, the KeyValue counter increments from 0 to 1. Subsequent collectable objects follow the same logic; each time an object is collected, the KeyValue count increases until it reaches 5.

Experience effect in Play mode

Now that all the components for the objects have been configured, the door will automatically open when all five objects are collected. Let’s see how this works in play mode.

Feel free to share your experiences and any questions you might have about implementing event triggers in the comments below. Happy game-making! :partying_face: :smiling_face_with_three_hearts: