How to run a Custom event from server to client?

In short :

Happen on the server: On the ThirdPersonBP: Player dies - Spawn a new character - delay .2 sec - Posses - Cast to playercontroller -

(this should run a custom event on the client playercontroller) = Clear HUD -

then on thirdPersonBP: detach from Controller

long story :

So basically I would like to kill my player. My problem is that I don’t have access to the HUD after I spawn the new character. On the player controller, I create the main widget and store it in the variable ‘Main HUD’ which is own by player1, but when player1 dies and spawns as player 2 that character doesn’t own the ‘main HUD’ variable. Basically I think my best option would be to run a custom event on the client that clears the HUD and create the widget again. It works on a single player but the custom even will never run if the player is a client.

Your player controller should be the “controlling owner” of UI.

Game mode → kill player EVENT
controller unpossess pawn → destroy pawn actor …
controller manages ui’s loads/unloads

Game mode -> spawn new pawn for controller -> controller possess pawn -> updates UI

ok so my Game mode will spawn the new character. How do i update my UI?

Player Controller … https://docs.unrealengine.com/en-US/…ler/index.html

First you need to create a custom event in the player controller to set a reference for the pawn.

From there you use EVENT ON POSSESS to call “Set Controlled Pawn”. This will automatically set/update your Pawn/Character reference when the controller possesses a pawn. Once the Pawn reference is set you can then Load your UI elements.

*** Just for Note … You do not need a PAWN in order to load UI//widgets etc. The controller itself is the game world reference of you the player.

Bonus …

Toggling the HuD from the controller.

Pawn Movement inputs handled through the controller…

The controller processes inputs before the pawn class. So inputs should reside in the PC and call Pawn Events. The logic for the event should reside in the pawn class though.

Input Processing Procedure: https://docs.unrealengine.com/en-US/…put/index.html