When i originally posted the Ai tanks were not reporting their pawn names. Then in my first reply to my original post, I noted that when I told the AI Tanks to also report the player tank, suddenly they started also reporting their own pawn names.
Now what iâm saying is not only can I recreate is problem by commenting out a log macro, but the tanks that are told to auto possess on spawn do not do so, only the ones that are placed in level seem to have this effect.
Then I uploaded the same exact version of the project from before but where I told the tanks to log out this information (before they were logging out the distance in meters to where the crosshair was pointing, because thats what I was had last commited since you replied)
Perhaps to make it clearer this is the current UE_LOG requests in the current repository version:
void ATankAIController::BeginPlay() {
Super::BeginPlay();
if (Super::GetPawn()) {
UE_LOG(LogTemp, Warning, TEXT("AI Pawn Name: %s"), *(Super::GetPawn()->GetName()))
}
else {
UE_LOG(LogTemp, Warning, TEXT("AI Pawn Not Found."))
}
ATankPawn* PlayerTank = GetPlayerTank();
if (PlayerTank) {
UE_LOG(LogTemp, Warning, TEXT("TankAi controller detected player tank: %s"), *(PlayerTank->GetName()))
}
else {
UE_LOG(LogTemp, Warning, TEXT("TankAi Controller couldn't find a player tank in the level."))
}
}
and when I comment out this part , like so:
ATankPawn* PlayerTank = GetPlayerTank();
if (PlayerTank) {
//UE_LOG(LogTemp, Warning, TEXT("TankAi controller detected player tank: %s"), *(PlayerTank->GetName()))
}
else {
//UE_LOG(LogTemp, Warning, TEXT("TankAi Controller couldn't find a player tank in the level."))
}
}
Then guess what happens? The program fails to find pawn at Super::GetPawn()->GetName(), when the only thing changed was a UE_LOG !
Maybe its hard to understand because of the bizzare nature of the problem I am describing. But you heard me rightâŚ
And as I said, There is also the second problem of the tanks failing to get pawn at Super::GetPawn()->GetName(), when they are spawned in the world, even when setting the tank blueprint to have the AIController auto posses when spawned. They only find GetPawn() when they are told to auto-possess for placed in world. (This is in the version with the extra UE_LOG of the Player Tank Pawn included)
Also i realize the âSuper::â syntax is not needed, this was included as a debug attempt.