Here is my issue I’ve just added a Dynamic_Multicast_delegate to my code SetPawn seems to be the best method to use for the listening function however when I hit play I get Acces Violation from the PlayerController in BeginPlay() on line 13: auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); using dump file I see that FindComponentByClass is the method causing the unhandled exception stating this->Pawn was nullptr here is the code for SetPawn `void ATankAIController::SetPawn(APawn* InPawn)
{
Super::SetPawn(InPawn);
if (InPawn)
{
auto PossesedTank = Cast<ATank>(InPawn);
if (!ensure(PossesedTank)) { return; }
PossesedTank->OnTankDeath.AddUniqueDynamic(this, &ATankPlayerController::OnPossesedTankDeath);
}
using OnPossess end up with Ensure condition failed: PlayerTank [File:E:\Unreal Projects\Tank-Game-master\Source\BattleTank\Private\TankAIController.cpp] [Line: 50] ( auto PlayerTank = Cast<ATank>(GetWorld()->GetFirstPlayerController()->GetPawn()); )