Download

[Need Help] Replicating Widget Actor in multiplayer lobby

've been working on a little 1V1 snipper project to try and get a better grip on the replication and the game framework of unreal engine.

So after the core gameplay, I’m trying to make a lobby system. I’ve been able to make the player join together without any issues, but I struggle a little bit with the replication. I’m trying to show the player’s name over their pawn in the lobby, and I can’t get it to work. In the client, both their name doesn’t get replicated, and in the server, only the server name appears And I get this error from the server logs:


 
 [2020.01.21-00.45.03:318][906]PIE: Error: Only Local Player Controllers can be assigned to widgets. BP_PlayerLobbyController_C_1 is not a Local Player Controller. [2020.01.21-00.45.03:321][906]LogScript: Warning: Accessed None trying to read property CallFunc_Create_ReturnValue         BP_PlayerLobbyController_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_PlayerLobbyController_C_1         Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ExecuteUbergraph_BP_PlayerLobbyController:0049 [2020.01.21-00.45.03:323][906]LogScript: Warning: Script call stack:         Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ReceiveBeginPlay         Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ExecuteUbergraph_BP_PlayerLobbyController  [2020.01.21-00.45.03:325][906]LogOnlineSession: Warning: OSS: No game present to join for session (GameSession) [2020.01.21-00.45.03:326][906]LogTemp: POST LOGIN FOR [2020.01.21-00.45.03:331][906]LogScript: Warning: Accessed None trying to read property CallFunc_GetController_ReturnValue         BP_Character_Lobby_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_Character_Lobby_C_1         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name:00CC [2020.01.21-00.45.03:333][906]LogScript: Warning: Script call stack:         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ReceiveBeginPlay         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ExecuteUbergraph_BP_Character_Lobby         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name  [2020.01.21-00.45.03:335][906]LogScript: Warning: Accessed None         BP_Character_Lobby_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_Character_Lobby_C_1         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name:00E1 [2020.01.21-00.45.03:337][906]LogScript: Warning: Script call stack:         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ReceiveBeginPlay         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ExecuteUbergraph_BP_Character_Lobby         Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name 

So I get that something is wrong with accessing the 2nd player controller from bluprint like this

But I don’t know how to make it work other wise. I’ve set the PlayerName widget to replicated, but it doesn’t seem to work.

Any idea on how I could get this to work?

Is doing this in Blueprints is mandatory ?

No, It would be better in c++, but I wasn’t sure how to do it. I get the player after login, and I could call a function on it. but I figured I would have the same problem still. But to answer your question, it is not mandatory, I would prefer to do it in C++!

Widgets are local only, you would need to create that widget on every client that should see it. For example in our game, we have a widget component on the player, which is created locally for every client. This grabs infomration that is replicated. Widgets/UI should never be replicated. Server should never care for the widgets/do anything with the widgets.