Thanks, it helped me!
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.