How to prevent a health bar from spawning multiple times and stacking

Hello,

I am trying to setup a enemy health bar similar to say Diablo IV in how it has a bar on the players UI at the top of the screen and one small one floating above the enemy. I got them to work mostly. However the UI health bar when I have multiple enemies loaded ends up spawning the bars on top of each other in the UI instead of just the one the player is looking at. My first thought was to use the hit actor result from the trace in the BP_Player_Core but I’m having no luck solving it on my own through trial and error. I attached images of the Player BP trace and the enemy logic.

Sorry if it’s something simple and I just missed it this is my first time trying to make a actual functioning game.

Seems like you may need to setup functionality to destruct the UI widget then construct a new one on target change

Hey,

Yeah it looks like because your containing the Logic in the Enemy the Do Once is running once Per Enemy instead of as a whole, assuming that is the one at the top of the screen.

Ideally, I would move the logic of creating that widget to the Player and probably create the widget on BeginPlay and have an empty state where it is Hidden and then use the Player to call a function that sets the looked at enemy as it looks towards and away from enemies which makes it visible and shows the Enemy and sets the needed info based on the passed in enemy.