So I used Brackey's 2d melee attack tutorial. So I have a player and two different types of enemies. the problem is one of them isn't taking damage when I attack them. In the console. When I attack enemy a, I get the message "NullreferenceException: Object reference not set to an instance of an object. AhmadAttack.Attack () (at Assets/Scene 2 stuff/ Ahmad Attack.cs(either 89, 65 or 77))" and when I attack enemy be, I get the message "NullreferenceException: Object reference not set to an instance of an object. AhmadAttack.Attack () (at Assets/Scene 2 stuff/ Ahmad Attack.cs(either 88, 64 or 76)). The problem is I have 2 enemies that run on different scripts and when I attack enemy A, I get the null reference error for Enemy B. When I attack Enemy B, I get a null reference error for Enemy A. How Do I fix this?
I think merge the enemy scripts to one, that containes the basic paremeters (health etc.) and make the other scripts reference to that EnemyBasicStats script.
Answers
Hi!
I think merge the enemy scripts to one, that containes the basic paremeters (health etc.) and make the other scripts reference to that EnemyBasicStats script.