Knowledge base
Knowledge base
1. TICK MANAGEMENT: - Disable tick on static actors (SetActorTickEnabled=false). - Use SetActorTickInterval(0.1-0.5) for AI, non-critical systems. - Prefer event-driven over tick polling where possible.
2. AVOID EVERY-TICK EXPENSIVE CALLS: - GetAllActorsOfClass: cache in BeginPlay, refresh only when needed. - CastTo: cache result in variable after first cast. - GetComponentByClass: call once and store reference.
3. VISIBILITY: - SetActorHiddenInGame + SetActorTickEnabled=false for off-screen actors. - Use LOD (Level of Detail) on meshes.
4. SPAWNING: - Use object pooling for frequently spawned/destroyed actors (bullets, effects).
5. EVENTS OVER POLLING: - Use overlap events instead of periodic distance checks. - Use delegates/dispatchers instead of checking conditions each frame.