Hi, I was trying to use “On Actor Begin Overlap” to do stuff when actors spawn into each other, right after their level loads, but it wasn’t firing every time.
So I tried to get overlapping actors on Event BeginPlay. But that wasn’t running every time either.
So I put a “Delay Until Next Tick” node right after BeginPlay, and it seems to be working consistently. But is it reliable?
Thanks.
No, Delay Until Next Tick
is 1 local frame.
The order that actors load during level loading isn’t guaranteed. They could at times load at the same time causing the overlap to not trigger. One way around this is to disable overlap collision then turn it on later.
Most of the time I use collision components which are more reliable than mesh collisions. If I absolutely need a guaranteed overlap I’ll use a trace. Sphere or Box centered on the actor. Just give it a delay before firing. I use timers for this type of stuff in case I need to fire it again on no hits/overlaps.
Thanks.
If you check 2 actors for overlapping, do you put collision components on both, or is one enough?
Isn’t that checking every tick? What if you have hundreds of actors, is it efficient?
One is generally enough. Put it on the one that’s doing the checking.
Don’t trace on Tick. Use Set Timer by Event or Function
. Call the timer directly vs looping it.
If you are checking for multiple actors then use a multi-trace.
Details on what exactly you are trying to build would help.
I’m trying to check for overlapping between 2 actors. Not only when the level loads, but also later if one spawns later.
2 specific Actors Overlapping each other?
Use a collision component and a custom collision preset.
Thanks. It says there “in case a streaming level loads around an actor”. Do you know if it also works when 2 actors load together as part of the same level?
And do they both have to enable the option?
Read the rest of the tooltip, says “includes initial level load”, so it should work.
Try it out and report back if it doesn’t though!
I played with it, and it seems to be working consistently when enabling the option on both actors. But NOT if it’s enabled only on one.
Fingers crossed.