Hi Bilal,
NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.
Do not assign an enemy from your Hierarchy to your enemy prefab variable because if that enemy gets destroy, no new enemies can get spawned anymore.
See also:
- Forum User Guides : How to mark a topic as solved