BP-CAST-001
Flags Blueprints with multiple dynamic casts to other Blueprint classes. The real cost isn’t the cast itself—it’s the hard reference that forces the target Blueprint to load when the casting Blueprint loads.
Why It Matters
Casting has two separate costs:
| Cost | When | Impact |
|---|---|---|
| Runtime | Each cast executes | ~0.05ms (minor) |
| Load | Casting Blueprint loads | MBs of memory (major) |
The key insight: Casting to BP_Enemy embeds a hard reference. When your Blueprint loads, BP_Enemy + all its dependencies load too—even if the cast never runs.
When It’s Acceptable
- Framework casts: GameInstance, GameMode, PlayerController (singletons)
- Native C++ casts: No Blueprint dependency loading
- Same-package casts: Already share dependencies
The Fix
Option 1: Blueprint Interfaces (Recommended)
Before: Get Actor → Cast to BP_Enemy → Call TakeDamage
After: Get Actor → Does Implement Interface? → Call TakeDamage (Message)
No hard reference to the implementation class.
Option 2: Cache Cast Results
Cast once in BeginPlay, store the result.
Option 3: C++ Base Class
Cast to a C++ parent class instead of the Blueprint child.
Configuration
Project Settings → Blueprint Health Analyzer → BP-CAST-001 → 6.0
Related
- BP-REF-001 — Hard reference cascades
- BP-TICK-001 — Casts on Tick paths