giving multiple of the same actor the same varible

I am a beginner to unreal, which I am studying at collage, and I have a group project, it is a WW1 based game, I have just started to make it and I have a problem with the enemies, which is that the health bar above their head is not really working, and to be exact, since I am using the same actor for the many enemies, all of their variables are connected.

which means that if you have multiple of them placed and you shoot the first one, all of the other copies with show the same health as the one that was shot, but if you were to shoot the copies then the health bar would not change but their health variable would, so if the first one dies and gets deleted, it will go to the next one that was placed and their health would be shown on all of the other copies.

that is my problem and if anyone could help that would be greatly appreciated

Each instance has their own variable, you’re probably updating it incorrectly. Could you show the script that adjusts health? This sounds very much like a GetAllActorsGet 0 issue.

1 Like

How is the health system setup? Alamars Dev Domain on YouTube has a great tutorial for setting up a replicateable syatem with GAS in c++. It also goes into settings up health bars for the enemies. If your assigning the health variable through the classes BP make sure it is instance editable


this is what I have set up for the health for the dummies

This looks fine.

their health would be shown on all of the other copies.

The question was more related to the above. How is the widget showing health? How is it updated? How does each widget retrieve EnemiesHealth from its actor?

whenever the dummies are shot, the health bar would show their exact health, but it will show only one of the dummies health, even if they have different amounts of health

which I think it might be the widget but I cant find the problem

1 Like

As expected then. This will never work. The Get Actor of Class gets the first actor it can find in the world, not the actor that just lost health. Think of it as of Random Actor. We can’t use it. Also, the binding executes every frame - read the tooltip of the node - it tells you to specifically not use it like this.


You are using a widget component for this, right? Have a look at this thread:

Same question answered yesterday.

thanks so much ill try it out