My enemy health bar is not working whenever I tried to add multiple enemies to my scene. Only one slider. Or if I shoot my default enemy to kill its health bar decreases also other enemies’ health bar decreases as well.
Each ‘Slider’ as with each variable needs its own instance.
So if your running so 100 enemies at a time, you will need it to track 100 sets of the variables and 100 sliders, one for each of them.
You can use for example a Array to store them all then use a for each loop on it to update each one at a time.
Also running it in the Update loop might be a issue with performance depending on just how many it needs to look at and update threw.
You made a class for it, so just create a instance array of that class elsewhere to manage it as needed, then 1 update loop to show sliders.
Create an array with the new command for how ever large you plan it on being, say
public class enemyHealthManager
… your class stuff
public enemyHealthManager myEnemyHealth = new enemyHealthManager;