UE4 General Event System

UE4 General Event System

1 Overview

This article was designed to provide users with a basic overview of the features and functionality of General Event System.

2 Introduction

General Event System is a UE4 plugin that provides the ability for any UObject to post and receive events with different parameters.The events of this system are defined in a single data table for unified management. A single event definition is composed of event id and arguments list. The listener object can register any defined event with a delegate function. Once the target event is received by listener object and the delegate function will be called. One can post event with parameters from anywhere.

3 Quick Start

Following blew steps, you will use this tool quickly.

(1) Create events defination data table

In Content Browser of UE4 Editor, click right mouse button and select “Miscellaneous” -> “Data Table” as follow.

CreateTable

Select row structure “Event Def” as follow.

RowDef

An example is given in Content\ThirdPersonBP\Blueprints\GlobalEventDefTable.

(2) Define events in the data table

After creating the data table, you can add event definitions according to your requirement.

EventTable

Each row of table represents a definition of one event.

  • EventID: The unique ID of an event. The ID must be unique inside the table.

  • Args: The arguments list define the type of parameters, that will pass by the event for delegate function. The arguments’ order and type of the delegate function must be same as Args defined in data table.

(3) Create an event manager blueprint

In Content Browser of UE4 Editor, click right mouse button and select “Blueprint Class”. Pick “EventManager” as Parent Class.

EventMgr

Open the event manager blueprint and config the event definitions table.

EventMgr

An example is given in Content\ThirdPersonBP\Blueprints\BP_GeneralEventManager.

(4) Config event manager singleton class

Open ProjectSetting in UE4 Editor and select the event manager blueprint, created in Step (3), as the Game Singleton Class.

SingletonClass

Users must restart UE4 Editor to take the config into effect.

(5) Create event listener and register events

For the object that needs to receive events, users should create “EventLisener” varaible and delegate functions.

Call “Register” node to register event and its delegate function. User should unregister events after the listener is destroyed.

An example is given in Content\ThirdPersonBP\Blueprints\MainUI.

(6) Post event with parameters

User can post event in anywhere. All listeners will receive event and their delegate functions will be call.

Notice that the parametes should be pushed in order as the arguments list defined in data table in Step (2). After pushing all parameters into buffer, user can post targer event by Post Event node.

An example is given in Content\ThirdPersonBP\Blueprints\ThirdPersonCharacter.

4 Compile plugin for your C++ project

if you want to add the plugin to your own project, just following the steps given below.

  • Put GeneralEventSystem to folder “Plugins” in your project.

  • Right click your project file(.uprojcet) and select “Generate Visual Studio project files”

  • Open Visual Studio project and complile.

5 Support

In the event you are unable to find the information you seek, feel free to contact stephen.coderx@gmail.com.

References

[1] Unreal Engine API

[2] UE4 Marketplace

[3] Quick Logo Designer

[4] My UE4 Marketplace Assets

Vistied:
Share: Twitter Facebook LinkedIn