How to use Set Owner Player node

I have 4 floating healthbar widgets for each of the pawns in a splitscreen local multiplayer game.

I am doing this because I need each one to face toward the camera of one of the splitscreen viewport owning players rather than having them all face toward player 0.

I have to set the Owner of each widget component properly so that each player’s viewport only sees the Widget component on the enemy tank that is owned by the viewport owner player. Each of the 4 widgets on each pawn has its “Only Owner See” checkbox ticked.

The problem is that I can’t seem to find a blueprint node that gets a Local Player Object, but Widget components “Set Owner Player” node only accepts Local Player Object references, not Player Controller references.

I also can’t define a variable of type “Local Player Object”. The “Set Owner Player” seemed like what I need, but it requires a data type that doesn’t appear to exist.

Does anyone know how to get a reference to a given Local Player Object (not Player Controller)?

Hey there, i assume each player has its own player controller. If that is the case when you create the widget you associate a owning controller to it. Then on the UMG widget you can access the controller and the pawn by using Get Owning Player and Get Owning Player Pawn.

Right, but I’m trying to find a way to reference a Local Player object, not a Player Controller or Pawn.

It’s okay though, I found a way around it. Instead of including the widgets as components on the pawn, I put them on a separate Actor which is added dynamically whenever the Pawn is possessed. It adds one of the same widget for every locally-controlled pawn.

For some weird reason, all the widgets are invisible when “Only Owner See” is ticked unless the owner is a certain Pawn, as far as I can tell (luckily it’s the main pawn type used during gameplay, but not the default pawn). I have no idea why it doesn’t let the Player Controller see it if it is the owner, or any other kind of Pawns, so the widgets all disappear off of the other players they are following around when the owning pawn that generated them is destroyed.

But that’s good enough for now. I just wish I understood why it’s so picky about what you can set as an owner.

Long story short: I used Actor ownership instead of widget component ownership to get around the problem since there is apparently no way to create a Local Player object to set on a widget component reference, and if I retrieve a Local Player reference from an existing widget component, then it’s ALWAYS LocalPlayer_0, even when the widget is on a different splitscreen player. I wish there was some documentation I could read on why it is that way. But my workaround is probably good enough.

Even better solution: add widget component to the pawn for floating healthbar,
Use worldspace and owner no see,
Use widget material that renders facing the camera no matter which direction it is actually facing.
This eliminates the need for any logic to keep track of who owns which bar, and you only need one bar per pawn.