First Person Exploration Kit: Creating a Basic Event Trigger


Event Triggers

Event Triggers are used to create scripted sequences or actions when the player enters a trigger volume. The events can be as simple or complex as you like, as they are defined in the Inspector using Events. Please refer to the demoTriggers prefab included with the asset and in the demo for an example.

Here are the steps required to make a basic event trigger:

  1. Create an empty Game Object, rename it "MyEventTrigger"
  2. Add a Box Collider, and check the "Is Trigger" flag. This will be the trigger volume that the player must walk into to trigger the events.
  3. Add the FPEEventTrigger component.
  4. Adjust the rest of the Inspector fields:
  5. Run the scene, and walk the player into the trigger.
  6. Edit your list of events according to the results you want for this sequence of events.

Note: By default, Event Trigger states are saved and loaded at a basic level. For example, if you have a few triggers in your scene in various armed or disarmed states when the game is saved, those states will be restored when the game is loaded. Saving additional outcomes from trigger Events may require additional effort. For example, if a trigger spawns a Pickup object, that will be saved for you since Pickups are automatically saved. But if your trigger makes a cutscene play or wall crumble, you will need to save those states yourself. Please refer to the Save/Load System documentation and included demoTrigger prefab for more details.

Below is a screenshot of the sample trigger created from the above steps. This trigger Arms on start, plays a sound for each of its events, then disarms itself when activated.


Below is a screenshot showing a trigger that is not yet armed (red).


Below is a screenshot showing a trigger that armed (green).