I need help with being able to have more than one enemy in the game.

I followed Brakeys RPG Tutorial and I tried adding two enemies in the game after finishing the series but when I attack the second enemy, the player attacks the other enemies health and when the other enemy dies and I keep attacking the second enemy, I get…
MissingReferenceException: The object of type ‘EnemyStats’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.

it then references me to the CharacterCombat script and the CharacterStats script.

thank you for any help.

you can just make a prefab of the first enemy. if you haven’t already that is.

I have tried the prefab thing but it still only attack the first enemy even though I’m attacking the other enemy on the other side of the room. if you need to see the code, you can see it on brakeys Youtube channel with there rpg series because I believe it would be way more helpful as he also explains it.

You are destroying the prefab, try putting the prefab somewhere else where the player can’t destroy it.

Hey @FunnyGameYouKnow , could you post your script so I could look at it? If you dulpercated your enemy, you might have to change some values in the inspector.