Custom event fires twice for unknown reason

I have a problem with a custom event running two times in a row for some strange reason. I haven’t posted images of the graph since I’m not sure how that will help. Hopefully I can explain the situation and someone can point me in the right direction to figure out what’s up.

Basically, I have taken the BlackJack sample project and am doing a card/board game based on this setup. Everything works quite well so far, but one of my custom events is duplicating its action for no apparent reason. I have set up the game to allow cards to be clicked making them active. Based on what card is active, a board can be manipulated to place a game piece. After the piece is placed, the card is replaced (destroy and spawn a new one in its place). However, what happens in certain instances is that the replace event runs two times in a row. It’s only called one time and watching the flow in debug mode shows that it is getting to the end of the custom event and immediately firing again, but I have no idea why. I’ve walked through the flow step by step with and without break points and can’t see anywhere that this might be set to fire twice. Also, it’s a single player game and I’ve ensured that when playing in PIE that I’m not running a dedicated server so replication shouldn’t be an issue.

Outside of setting a break point and watching what happens, how can I begin to see what’s going on here? The break point only shows the active node, not what is going on behind the scenes. My project is only using BP, so unless there’s Epic code doing something strange, it’s not a C++ issue.

So, does anyone know off the top of their head why this might happen? If not, what other tools do I have that could help find what’s causing it? I’m completely at a loss.

If more info is needed, I’ll post screens of my event graph. Just not sure what that will help.

Thanks in advance…

Got some answers on the forums so I think this can be closed unless someone knows what the issue actually was. Found a way to make it work, but still not really sure why it happened in the first place.

From forums… I tried looking at the Blueprint Debugger, but can’t tell what is going on there at all. I’ll have to look for more info on that at some point. Like Fen said, I tried a DoOnce node and added resets where needed and that seems to have fixed the issue for the moment. Still not sure why it happened in the first place. I had checked where all it might have been called and it was only in that one place and there was no good reason. I also changed to click releases rather than clicks just to be safe, but I think the DoOnce nodes will be good enough.

Thanks all.

I am experiencing probably same issue now, I can confirm that it is very strange.

I have custom C++ Actor component which has BlueprintAssignable delegate.

In BP, when I select variable containing this component I can see list of green buttons representing my events.
When I click on green button, new event is created and when I call that event (delegate) in code it is called two times in BP! But…

When I create Custom Event and link event using Bind event node in Begin Play it gets called only one time, so this way it works as expected

Anybody has idea why it is called two times when event is created by green button ?

Version 4.8.3

1 Like

Hi guys, does this happen to you in Editor version and Packaged version of the project or just Standalone version of the game?

I tested just in PIE.

This is an older thread but I was able to fix my firing twice issue by recreating the custom event. I know this won’t work in all cases but it was my work around.

I’m actually in C++ having this issue and solved it. I was researching to see if there was a problem in the engine, or if there was a know wrong way of doing things that would cause this and found this forum. I know this is a blueprint thread however the issue is the same. I placed a Boolean in my overridden SetupInputComponent in my custom PlayerController class, with logic so it would only bind my actions once, just in case its being called twice. Sure enough, it was calling my input bindings twice and my Boolean had already been set to true preventing a second set of duplicate mappings. That fixed my issues where keyboard button mappings, ones that were used as a toggle for a feature that would toggle on then back off.

I think what was causing the issue is how i was spawning in my character and assigning its player controller. In my game mode i have a spectator pawn as default pawn, i play an opening movie and when its done i spawn my player in and using the reference to my custom Player controller class, i would then unpossess the spectator and possess the player character. So i think it was binding on possess, once for the spectator, then my actual player.

If anyone does this with the same player controller, it will bind twice causing 2 calls to your event on one press…

If anyone else has a better explanation im open to hear it.

Edit: I changed the logic in my SetupInputComponent to check and see if my private reference to my custom player class is valid, which is assigned on posses. So if it possesses any pawn other than the class i want to have mappings for it the bindings are not assigned.

So blueprint project for me.(bit of a mash to be honest).
Had events double and triple firing from game instance into level and randomly into other levels from game instance.
Had same issues. did a mountain of debugs.
I could not handle setting up do once nodes as I felt it was hiding a bigger issue.
In the end, like some others above, I recreated the custom event and things are flawless.
Weird for sure. Windows/Mac/Android/ios 4.20.3

And Nope!-Human error I had an old image on both levels triggering the event in error. I guess re-using that trigger was a bad Idea lol. Either way I will leave here as a debug step to helping find a solution.

-D

This solved it for me.
I tried this after I did bp node search which resulted in no suspicious/ duplicate calling.
Nothing I did would prevent the double event call, except creating a new event.

Thanks Matt.