An error when casting

I forgot to mention it, but posting it here for reference: there is a templated version of GetPawn, which lets you cast to your type directly. This is just for convenience, slightly faster to type:

Instead of:

AAICharacter* EnemyAI = Cast<AAICharacter>(GetPawn());

You can type:

AAICharacter* EnemyAI = GetPawn<AAICharacter>();

This doesn’t change anything, you still need to check if EnemyAI is valid, in case the cast failed.