I recently updated my project to UE 5.5 and ran into the issue described in this post
The solution suggested there certainly will work, but if you’re compiling from source I believe I’ve found an easier solution. Make the following change to WidgetComponent.cpp:
Explanation: client controlled pawns have controllers on a listen server, but they don’t have a ULocalPlayer, so this method will always return null for client pawns, causing them to not be displayed. Not sure what the original intention here was…maybe just a bug?
I’m not compiling the engine from source, but I made this workaround method instead:
void WorkaroundOwnerPlayer(UWidgetComponent* WidgetComponent, const UWorld* World)
{
if (WidgetComponent && World)
{
if (WidgetComponent->GetOwnerPlayer() == nullptr)
{
if (const UGameInstance* GameInstance = World->GetGameInstance())
{
WidgetComponent->SetOwnerPlayer(GameInstance->GetFirstGamePlayer());
}
}
}
}
I call this method in the code that runs on the (listen) server right before I do SetVisibility(true) on my WidgetComponent.
I did it in C++, I don’t think you can do the same in Blueprint unfortunately. Although both GetOwnerPlayer and SetOwnerPlayer are BlueprintCallable, as far as I know there is no way to do something like GetFirstGamePlayer in Blueprint
I’m also curious if this is a bug or not … I’m on 5.5.4 at the moment.