UE4/EventListeners

From PopcornFX
Jump to: navigation, search
UE4-logo-g.png

(last edit version: v1.0.0-preview-5)

/!\ Please note that this feature is highly experimental, and is subject to change. /!\

Reminder

Effects can trigger and broadcast Events. Broadcasted events will notify UE4.

In this example, MyCustomEvent will be broadcasted:

Ue-eventlisteners-events.jpg Ue-eventlisteners-scripting.jpg

Event Listeners

Event Listeners allow you to "listen" to specific broadcasted events.

You can globally hook delegates to specific event names. When any particle evolving in the PopcornFXScene broadcasts the desired event, your delegate will be called.

Inside your delegate's scope, you will be able to recover any particle field that was previously registered.

Setup

You will need to follow some guidelines to enable this feature.

  • Register Event Listener and Unregister Event Listener are the two functions that you will have to use. Once the event listener is registered, your delegate will be called each time any event that has a matching name is broadcasted.
  • The PopcornFXScene has a global array of Field Listeners that you need to setup. You add in this array the list of fields that you would like to access when an event delegate is called.
  • If the Field Listeners are correctly setup in the PopcornFXScene, you can get their value by using Get Particle Field.

Ue-eventlisteners-blueprint.jpg Ue-eventlisteners-scene.jpg