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);