Event Dispatch cancelled if called again during delay

So I have this event dispatcher that receives data then does something. This event for dispatcher has a delay in however, if I get to delay, and if data was dispatched again before this event finished it will start new dispatch and it will never turn back to finish original one and just continue on with current one. Its as if, original dispatch was cancelled. I don’t see anything in documentation documenting this behavior, so is it a bug?

EDIT:

There appears to be more to this, it may not be cancelled, but something really weird is going on. blueprint that receives data is a base class, right after delay there is a ‘switch’, it switches on a value that’s passed as a parameter from dispatcher. Based on what I’m seeing, it appears it does return to original HOWEVER, it may be using value from new dispatch call instead of original.

EDIT:

After more testing it appears that all values being passed into second dispatch call replaced all original values from original call. Not only that, second dispatch call happens on a completely different object, but they share same base class where event is located. I confirmed this by putting watches on all values. It’s not even possible for it to be where it is in flow control with values it has now, and as a result it moves down an unexpected path. These parameter values for events are just vectors and a structs.

I hope this helps, let me know if you have any trouble replicating issue.

Hey ,

I wasn’t able to reproduce this behavior, but I may not have it set up way you do. Are you able to reproduce this in a new project? Can you provide some images of Event Dispatcher calls and anywhere else it is used? If you would prefer to link me to a test project in which this happens, that would be fine as well. Thanks!

I’ll try to replicate it, but it may be difficult to (and time consuming).I’m also willing to send my full project if there is a way to privately send it, maybe by using forums?

I was actually able to recreate this Bug VERY easily.here is a simple project to replicate it: just press button on screen when running game. It should print Dog, then Cat, instead it prints Cat Twice, for reasons I describe above.
https://.com/file/d/0B8XPnhYs_LxmUDNVRDlMa1FGNTg/view?usp=sharing

Just to add, key place to look is in “ParentObject”.Thats where event occurs. Also, you can ‘fix’ issue by just removing delay in function, then it will print Dog then Cat as it should. Re adding delay of 0.8 will break it again, showing a ‘Cat, Cat’ print. Walking through statements, you should observe parameters from second call, replace ones from original changing what should be a print of ‘Dog’ into ‘Cat’.

Hey ,

It appears that problem is placement of your delay. When TestEvent is called, it calls TestDispatcher twice. Event you have linked to it has a delay in it, but TestEvent (in GameMode) does not care what’s happening in bound event, so it tries to call TestDispatcher again with new values before delay in first Event has finished. Then by time print strings are run, it’s using latest values set.

Hope that makes sense. To get desired effect, you need to make sure events bound to your dispatchers don’t have a delay in them. Instead, you need to place delays where dispatchers are called, and remember that using a delay inside an event bound to a dispatcher does not delay execution of node following dispatcher call.

Hope that helps! Let me know if you have any questions or need help setting this up in your project.

That’s still really weird to me, event was technically attached to two different objects in memory, why should it be replacing values existing in one object with another? Are events called by a dispatcher not actually part of an object instance? I’m just trying to figure out how events are working because in my mind it makes no sense for objects sent to one object to replace them in another.

is there single instances of events? So every time an event is called it reuses that instance on object instead of creating a new one on stack? So second dispatcher alters that instance?

dispatcher does not create a unique instance of itself each time it is called, so yes, passing new values to its events will replace previous values. If you’re using same dispatcher for multiple actors and each are setting its events’ values, you’ll need to make sure you are doing so in correct order (and delays are always tricky when used inside custom events and functions). Another solution may be to use multiple dispatchers, just to make sure you they aren’t stepping on each others’ toes.

So, I found best way to resolve this was to develop an event queue of sorts. In case of my application, I had a series of delays between creation of rolling text indicators (as I didn’t want them to all appear at once). As a result of issue described above, if dispatcher triggered event before all rolling text could finish animating, text would be replaced with incoming event. So what I did was remove all delays, create a struct called ‘TextIndicationEvent’, and queue these events in an Array. Then there was a Timer, that would pop these from queue every so often and animate them. These removed all delays in original event so it could finish immediately, therefore same dispatcher could not be called twice before finishing, resolving all my issues.

Thanks , that’s a great way of handling this issue.