OnComponentBeginOverlap being called across instances

So, I have some very simple code. I’ve set up an enemy using Blueprints, and in that is some code to kill the enemy when the player hits them.

This code is very simple. I use an OnComponentBeginOverlap node on the enemy’s main hitbox, which then tests if the overlapping component is a player attack collider. If it is, then the enemy dies, otherwise it does nothing.

Now here is the strange thing. I put this on my enemy, and then spawned two identical enemies in the world. If I attack the first one, it dies exactly as expected. However, if I attack the second one, both enemies die, regardless of whether the first one was actually hit. It looks as though, for some reason, OnComponentBeginOverlap is being called for both instances.

Even stranger, I managed to fix the behaviour by adding a simple check, after the OnComponentBeginOverlap node, to see if the “other component” is contained in the list of overlapping components. When I did that, this behaviour disappeared, which is consistent with OnComponentBeginOverlap being called fallaciously.

While the functionality is now there, I would like to not have to loop over all overlapping components every time I attack an enemy, and I would also like to know why this was happening in the first place.

Hey ,

Can you show me a screenshot of both the overlap functionality you are running as well as any corresponding data that is pulled from the player character (if any)? This will help to show what is going on and possibly what is causing the functionality to fire on all copies of your actor.

I’m not getting any data from the player character, but the overlap functionality is very simple:


The only objects in the entire project to have the “Attack” tag are the player’s attack collision components.

Although, the actual formulation of this function is fairly irrelevant, since it shouldn’t be being called at all (since the source of the call is not actually colliding with the enemy, hence the fix I found allowing me to just check if the object causing the event trigger is actually colliding or not).

Is it possible that both actors are overlapping the character simultaneously?

No, absolutely not. The colliders attached to the character are small (they’re sphere colliders of approximately 100 radius each), and the actors are at least 1000 units apart.

Do you have a sample project I can take a look at to see if I can see what is going on?

Edit: Additionally, the second actor you have, is it a duplicate of the first? For instance, did you alt+drag from the first actor to create the second? If so this may already be reported in our system.

Yes I did alt+drag to create the second actor, as I was copying across some instance properties. It’s good to know that there’s a report of it in the system, and that it’s not just my mind playing tricks on me.

This bug looks like it may have been fixed between 4.8 and 4.9. If you have a copy of 4.9 installed, could you try this on 4.9 and see if you receive the same error?

Unfortunately, the project didn’t translate well to 4.9, so it will have to wait to get a working copy.

what errors are you seeing when you attempt to update?

A few compile errors from outdated code, and a few errors that occur due to changes in the engine. It’s nothing that can’t be fixed, it just requires more time dedicated than anyone on our team can allocate at the moment.

Hi ,

I’m going to go ahead and mark this as answered for tracking purposes. Once you have the time and are able to update to 4.9, if you are still experiencing the error feel free to post here and I’ll be happy to take another look.