- Open the Editor
- Create two Actor BPs. One named Controller_BP and the other Receiver_BP
- In Controller_BP create an Event Dispatcher named 'OnSpaceBarPressed'
- In the Event Graph add a 'Space Bar' node and a call to OnSpaceBarPressed. Connect 'Pressed' to to OnSpaceBarPressed.
- # In the Class Defaults of Controller_BP change the 'Auto Receive Input' to Player 0
- In Receiver_BP create a variable referencing Controller_BP. and set it to Instance Editable
- In the Construction script of Receiver_BP add the following logic: Connect an IsValid node to the Construction Script, use the Controller_BP variable as the Input Object, add a 'Get All Actors of Class' node, set 'Controller_BP' as the Actor Class, and connect it to the 'Is Not Valid' pin, drag off from the 'Out Actors' pin and add a 'Get' node, drag a set of the Controller_BP variable and connect it to the exec pin from 'Get All Actors of Class' and to the output of the 'Get' node.
- Using the Controller_BP variable add the Event 'OnSpaceBarPressed' and connect a Print String to it.
- Drag instances of both Controller_BP and Receiver_BP into the Viewport
- Play in Editor and press space bar, you will see one "Hello".
- Exit PIE, open up Receiver_BP and force a compilation of the blueprint
- Play in Editor and press space bar, you will see two "Hello"s
- Select your Receiver in the World outliner, in Details -> Default, click on Reset to Default arrow next to the Controller_BP variable.
Or
- Open up the attached project and Play in Editor
- Play in Editor and press space bar, you will see one "Hello".
- Exit PIE, open up Receiver_BP and force a compilation of the blueprint
- Play in Editor and press space bar, you will see two "Hello"s
- Select your Receiver in the World outliner, in Details -> Default, click on Reset to Default arrow next to the Controller_BP variable.
Results: Each time you compile your receiver, it increases the number of calls from the implementation of the event dispatcher by 1.
Each time you reset your variable, it sets it back to 1
Expected: The number of call should always be 1, independently of the number of compilation of the receiver.