CreateWidget with local multiplayer

So i have this part of code to create widget on screen, but it only works on server and prints this error if i am trying to call this from client:
PIE: Error: Only Local Player Controllers can be assigned to widgets. BP_IgoraPlayerControllerBase_C_2 is not a Local Player Controller.
If i am checking for IsLocalPlayerController() it just does not work on client. (Excpected)

Is there a fix or it just wont work until i launch it as exe and connect as game expects? I just want to fix this so it wont be needed to be launched as exe each time

	if (WidgetToApply != nullptr)
	{
		AIgoraCharacter* Character = Cast<AIgoraCharacter>(GetCharacter());
		if (!Character)
			return false;
		//Set mouse visibility and click events according to params
		this->bShowMouseCursor = bShowMouseCursor;
		this->bEnableClickEvents = EnableClickEvents;

		//Create the widget
		CurrentWidget = CreateWidget<UUserWidget>(this, WidgetToApply);

		if (CurrentWidget != nullptr)
		{
			CurrentWidget->AddToViewport();
			return true;
		}
		else return false;
	}
	else return false;

Well the error is saying what I would expect. Only the local client can spawn UI. It won’t show for other clients. UI isn’t intended to be synchronised.

Which controller are you trying to run this on?

Nevermind, i realized that there is no point to send the hud spawn request from the server.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms