I want a reference to my playerclass for my hud. But the player reference keeps to be null.
world = GetWorld();//getting the world
if (world){ con = Cast<APlayerController>(world->GetFirstPlayerController());//getting the controller
UE_LOG(LogTemp, Warning,TEXT("WORLD")); }//This works fine
if (con){ player = Cast<APlayerCharacter>(con->GetCharacter());//planing to get the playerclass
UE_LOG(LogTemp, Warning, TEXT("CON")); }//this works fine too
if (player){ UE_LOG(LogTemp, Warning, TEXT("Player")); }//but this didnt got called...why ?