Health Bar Isn't working

So I’ve followed the tutorial found here. https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/4/index.html and I’ve looked through a lot of the questions about this I’ve change my parent class from pawn to actor however i construct them as Spectator pawns because my game is a matching game. The health bar is greyed out which i assume it means its not filling up. Also the minus health example given in the tutorial I believe is not working. Though this could be because of me trying to do it in the level blueprint rather then the character. However nothing was happening in the characters because they don’t do anything. The P_Health float is set to 1.0 like the tutorial says and its set inside my P1_Spectator blueprint class. I changed it from being parented by a pawn to an actor as I saw someone else fix they’re problem that way however it didn’t fix mine.

41396-health.png

I’ve included the Construction script in the spectator class that makes them spectators and the event the shows the HUD.

41398-construct.png

Game HUD widget needs a reference to the pawn so we can bind the health variable. In the tutorial I tried to get my pawn by casting it from GetPlayerCharacter how ever it didn’t work for me. So I created a variable in the Game HUD - a reference to my main Pawn - and sat it manually when I created the widget in my main pawn.
What I suggest is setting something instead of getting it by casting if DEPENDENCY isn’t an issue. This makes your HUD dependent to your pawn but in most games each type of pawn has it’s own HUD.

Something like this you mean? Unfortunately its not working. The Bar is still grey.

I’ve also noticed that while the HUD gets created by event play pressing these keys does not trigger the event it supposed to any idea why that is? Maybe that’s the source of my problems?

Hi , cast like this. include 0-1 aswell

you can cast at construct, and set VAR and run to this.

Thank you so much I was pulling my hair out over this. I don’t suppose you’d have an idea to my other question about stream matching?

Nah, sorry.

Struggling with single player.

Did you add your interface BP to your Character BP and assign values to it?