Overlap events fired twice

uem_s01_handling_overlap_events_in_c

#1

Hi, I am a bit stuck with this. Well it is more annoying than blocking. Every time the character steps on the pressure pad, the “Activated” message is fired twice.
Same when he steps away, the deactivated message is fired twice.First I was trying to register the event in the constructor but I had to put it in beginPlay because it wasn’t working. I kinda feel like it’s something happening in the Editor as I have double checked my code compared to yours but I don’t know what’s amiss. If anyone has a clue what’s going on, please feel free to share.
Thanks guys

B


#2

If you don’t register in the C++, does that remove both events? Have you fully restarted the editor since moving away from the constructor. This stuff can easily get cached.


#3

Yes I have commented out the line that registers the OnComponentBeginOverlap event and it removes both events. And yes I have restarted Editor today and I have no overlap begin event and two overlap end events, which were not commented out. I then uncommented the line and now I have the two messages back. So I don’t think the cache is the culprit. I was thinking somehow twi parts of the trigger emitted an overlap event at once or the player generates the event twice…


#4

I added other actor and component to the UE_LOG and the same actor and the trigger volume gernerate the collision each time.


#5

So still an issue?


#6

The below is tested on: Unreal engine Version: 4.18.1-3754814+++UE4+Release-4.18
IF you are certain your code is correct you could try the stupid “solution” below:

I had the same issue, with sometimes events even firing 4 times.
Strangely enough the deactivate event that was exactly the same as the activate event only fired once as it should.

Perhaps even more strangely after several project resets (closing and then reopening the project) it eventually just started working properly (this took multiple restarts because at first this didn’t do anything).

The code remained untouched and I didn’t change a thing.
So you might get it working by just restarting your project a few times, perhaps when you close it you remove the BP’s in the level first and reopen your project and place them back?


#7

It’s likely something cached in the editor. Restarts and total recompiles always help in such cases.


#8

If you have X players the Log will be fired X times, but the event is fired only once, I think the logs are separated for each player. Props to someone in the Q&A who posted that.


#9

For wut i did is:

  • use AddUniqueDynamic instead
  • put these into the “beginplay”

#10

I wasn’t able to get the AddUniqueDynamic working. But, if I put a HasAuthority() check in the overlap event It only prints once now.