UMG Healthbar is shared for multiple enemies
I have created a health bar in UMG for multiple enemies. It works great for the first enemy. The problem is that the other enemies share the same health bar. So after the first enemy dies the other enemies have their health bar already depleted.
I'm sure I'm not going about this the right way. So my question is what would be the best method to create enemy health bars that can work for multiple enemies and be independent of each other?
asked Feb 13 '15 at 05:15 PM in Blueprint Scripting
I would think each enemy would have to instantiate their own UMG Widget in their start up? so in the enemy blueprint there'd be a "Create Widget" in their construction or something like that - sorry I don't have the engine open right now but it's got to be something like that - hope that gives you an idea ;)
After looking around at different forums, I came with the solution that worked for me (Referencing this forum: https://answers.unrealengine.com/questions/194545/enemy-2d-health-bars.html).
On "event tick" I fire my "HealthBarUpdate" function, which updates the percentage of the enemies healthbars. The healthbar is a 3D Widget in the enemy blueprint (picture below).
This is how it looks above my enemy (picture below).
Hope this helps! :)
answered Jan 19 '17 at 08:05 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here