x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Event Dispatch cancelled if called again during delay

So I have this event dispatcher that receives data then does something. This event for the dispatcher has a delay in however, if I get to the delay, and if the data was dispatched again before this event finished it will start the new dispatch and it will never turn back to finish the original one and just continue on with the current one. Its as if, the original dispatch was cancelled. I don't see anything in the 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. The blueprint that receives the data is a base class, right after the delay there is a 'switch', it switches on a value that's passed as a parameter from the dispatcher. Based on what I'm seeing, it appears it does return to the original HOWEVER, it may be using the value from the new dispatch call instead of the original.

EDIT:

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

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

Product Version: Not Selected
Tags:
more ▼

asked Oct 26 '14 at 10:27 PM in Bug Reports

avatar image

Awdogsgo2heaven
166 14 21 28

avatar image Ben Halliday STAFF Oct 27 '14 at 09:12 PM

Hey Awdogsgo2heaven,

I wasn't able to reproduce this behavior, but I may not have it set up the way you do. Are you able to reproduce this in a new project? Can you provide some images of the 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!

avatar image Awdogsgo2heaven Oct 27 '14 at 11:28 PM

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 the forums?

avatar image Awdogsgo2heaven Oct 28 '14 at 12:12 AM

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

avatar image Awdogsgo2heaven Oct 28 '14 at 12:21 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey Awdogsgo2heaven,

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

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

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

more ▼

answered Oct 29 '14 at 07:30 PM

avatar image Awdogsgo2heaven Oct 29 '14 at 08:34 PM

That's still really weird to me, the 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.

avatar image Awdogsgo2heaven Oct 29 '14 at 08:38 PM

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

avatar image Ben Halliday STAFF Oct 29 '14 at 08:49 PM

The 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 the same dispatcher for multiple actors and each are setting its events' values, you'll need to make sure you are doing so in the 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.

avatar image Awdogsgo2heaven Oct 31 '14 at 07:23 PM

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

avatar image Ben Halliday STAFF Oct 31 '14 at 07:27 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question