1.2 - Event Dispatcher

An overview of the Level Scripting example level, example 1.2: Event Dispatcher used to open a door

Windows
MacOS
Linux
On this page

levelscripting_1_2.png

Another instance of the door Blueprint is used here, but this time it is opened or closed when the player steps on a button Blueprint. This button Blueprint uses a special dispatch event, which the level script can receive. When the button is pressed, the dispatch function is called. On its own, this does not do anything until the corresponding event is added to the level script.

Level Script

LevelScript_1_2_LS.png

The event dispatcher feature is useful for interactive objects like buttons, which can be re-used for different purposes without the need to copy a lot of script. All that is needed is for the Blueprint Actor's script to call the dispatch function, and for the level script to contain the event that the function will trigger. Then the level script can determine what that event will trigger.

BP_Double_Doors Event Graph

Click for full size or right-click and Save As.

The BP_Double_Doors Blueprint Actor contains a setup for a somewhat sophisticated door. You can see how the Timeline is used to drive several things, including the location of each door, the rotation of the bolt mechanism, and the Material applied to the bolt. The network is fired whenever the Blueprint receives the Open Doors or Close Doors events, which are custom events created for this Blueprint.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback