Hello i am trying to make a health bar for a zombie character but it wont work. The casting to the zombie blueprint dont work. When i cast it to the thirtperson bp everything is good. If somebody know this i will be very thankfull.
I found out after a couple of ours that when i cast it to the widget it works.
If the cast is failing, it means that the Zombie does not inherit from character. Cast to means treat as, so you’re asking to engine to pretend the Zombie is a player character.
If this is the Zombie’s healthbar in the graph above, you do not need to cast at all to be honest (that’s besides the fact that casting in a bound function is a bad idea in the first place).
Have the Zombie create its own widget healthbar and simply update the progress bar when the health pool gets depleted. That’s unless you really need to update the health bar every frame. The event based approach is almost always more efficient.