How i can cast to all Players on widget

Hi,

I want to send a variable from an actor to a widget.
Unfortunately, a widget can not have access to replicated variables.

So I tried the following:
I write the variable in all PlayerControllers.

But its dont work.
It must be somehow possible to display the life display of another player in a widget.

What exactly are you trying to achieve? Are you trying to allow each player to view each other’s health? If you are trying to allow all players to see each other’s health you should store the player’s health in their Player State object.

When you store the player health in the Player State you can get all Player State objects and iterate over them and render your UI health bars for each Player. All Player States are replicated to every machine (Authority and Client) because Player State is “public” data (unlike Player Controllers, which are only on Authority and the client machine that owns the Player Controller).

If you’re trying to display the health of an enemy actor then there are multiple ways you can achieve that… Before I go into more details I need a clearer explanation on what you are trying to achieve.

Add Owning Player into Create widget.

And after that. try to get player state form owning player pawn.