Unreal Engine 5 · Blueprint → C++
Get Overlapping Actors in Unreal Engine 5 C++UE Docs
The Blueprint Get Overlapping Actors node maps to GetOverlappingActors, available on both UPrimitiveComponent and AActor. It fills a TArray<AActor*> with everything currently overlapping.
Blueprint node & C++ equivalent
TArray<AActor*> OverlappingActors;
MyComponent->GetOverlappingActors(OverlappingActors); // or Actor->GetOverlappingActors(...)What does Get Overlapping Actors do?
It returns the set of actors that are overlapping right now, as a snapshot rather than an event. This is useful for area-of-effect logic where you need to know everyone inside a volume at a given instant, such as on a button press or timer.
Because it queries current state, it does not depend on having bound the begin or end overlap events.
How to use it in C++
Declare a TArray<AActor*> OverlappingActors; and pass it by reference: MyComponent->GetOverlappingActors(OverlappingActors);. The array is cleared and repopulated each call, so you can iterate it immediately afterward.
The same function exists on the actor with Actor->GetOverlappingActors(OverlappingActors);, which aggregates overlaps across all of the actor's components. An optional class filter parameter lets you restrict results to a specific actor subclass.
Frequently asked questions
How do I get all overlapping actors in UE5 C++?+
Pass a TArray<AActor*> by reference to GetOverlappingActors, for example MyComponent->GetOverlappingActors(OverlappingActors);. The array is filled with the actors currently overlapping.
Can I filter GetOverlappingActors by class?+
Yes, GetOverlappingActors accepts an optional TSubclassOf<AActor> filter as a second argument so only actors of that class are returned.