Variables changing in Prefab but not in instance

I am currently making a 2D tower defense game, which involves enemies going down a path and the player placing towers along the path to shoot at the enemies. However, when the bullet hits an enemy prefab and the function is called that causes the enemy to lose health, the prefab (as in, the item in the Prefab folder) is losing health in the inspector and not the instance of the enemy (as in, the game object in the hierarchy with (Clone) after it). Each enemies’ health should be unique to their instance. I am using a reference to the script on the object to subtract “damage” from the non-static “health” variable of the enemy.

enemyBehavior.TakeDamage (damage);

You need to use GetComponent because you search health in e but e is a GameObject variable not your script of class ‘ClassName’ so you need to call this script :

e.GetComponent<ClassName>().health -= damage;

Just replace ClassName by the name of the class/script of which you subtract heath.

Can you copy a bigger chunk of your code? Maybe this way we’ll be able to be of more use