(click on the link below in the post to enlarge or RMB > View Image)
// Code in PlayerController
if (GetPawn() == nullptr)
{
LOG_ERROR("The pawn is NULL for player: %s.", *(PlayerState != nullptr ? PlayerState->PlayerName : "<Unknown Player>"))
}
CreateWidgets();
The error is never logged and the Pawn is valid and is possessed by the PlayerController. However, the BluePrint-GUI complains about the GetOwningPlayerPawn-node returning a null-value. Note that this is multiplayer and I create the widgets (hopefully) on the owning client:
// In PlayerController header
UFUNCTION(Client, Reliable, BlueprintCallable, Category = "PlayerEyeController|GUI")
void CreateWidgets();
void CreateWidgets_Implementation();
The actual line of code (also inside the PlayerController class). Note that GUI_PlayerEye_Class is a Blueprint class. Also this problem only occurs in multiplayer, it works in singleplayer:
GUI_PlayerEye = CreateWidget<UPlayerEye_GUI>(this, GUI_PlayerEye_Class);