Hello. I am using one enemy that has a patrol variation. Normally, the enemy stands still and chases the player when the player comes in radius. I made a version of the enemy that patrols back and forth. In editor mode, everything works perfectly. But when I build and run it the idle enemy dies, but the patrol one is invincible. The knock back works but he won’t die. I am very frustrated and confused as to what is happening.
How my project is constructed is the enemy inherits from an Enemy script for health:
private void Awake()
{
health = maxHealth.initialValue;
}
private void Start()
{
health = maxHealth.initialValue;
}
private void TakeDamage(float damage)
{
health -= damage;
if (health <= 0)
{
soundSource.PlayOneShot(deathSound);
DeathEffect();
MakeLoot();
this.gameObject.SetActive(false);
}
}
Then I have a scriptable object that is a float value of 2 that is the health of the enemy. The script ‘Wolf’ inherits from the Enemy script, and then the paroling version inherits from the ‘Wolf’ script. They both have the same scritable object. Here is the one for the Wolf enemy:
Here is the patrol variation in the inspector:
What would cause this to work in the editor but not on build? I don’t get any errors related to my enemies.