BP-GETALL-001
Flags GetAllActorsOfClass and similar world queries. Cost scales with total actor count in the world, not matching count. Epic’s API docs explicitly warn about performance.
Why It Matters
Epic’s official warning: “GetAllActorsOfClass will be slow when there are many actors.”
| Function | Iterates | 500 Actors |
|---|---|---|
| GetAllActorsOfClass | Class hierarchy | ~0.08ms |
| GetAllActorsWithTag | ALL actors | ~0.20ms |
| GetAllActorsWithInterface | ALL actors | ~0.25ms |
Tag/Interface variants are 2-3× slower—they check every single actor.
When It’s Acceptable
- BeginPlay: Runs once at spawn
- Construction Script: Runs once when placed
- Slow timers (>5s): Periodic cleanup
- Editor-only code: Debugging tools
The Fix
Option 1: Registration Pattern (Recommended)
Actors announce themselves instead of being searched for:
// BP_Pickup BeginPlay:
Get GameMode → Call RegisterPickup(self)
// BP_Pickup EndPlay:
Get GameMode → Call UnregisterPickup(self)
// GameMode maintains ActivePickups array
// Any query: just return the array (O(1) vs O(n))
Option 2: Cache Results
Query once in BeginPlay, store in variable.
Option 3: Spatial Queries
For “find nearby”, use SphereOverlap instead—uses spatial acceleration.
Context Severity
| Context | Frequency | Severity |
|---|---|---|
| Event Tick | 60/sec | Critical |
| Fast Timer (under 0.1s) | 10+/sec | Critical |
| Timer (0.5s) | 2/sec | Warning |
| BeginPlay | Once | Info |
Configuration
Project Settings → Blueprint Health Analyzer → BP-GETALL-001 → 2.0
Related
- BP-TICK-001 — GetAllActors on Tick
- BP-CAST-001 — Casting results