Null Reference Exception and Enemy appearing at one point and disappears

I need some help here, I’m using Unity 2019.2, and I keep getting an error in the console saying a Null Reference Exception error:

And at the same time, whenever I go to play mode, the enemy spawns at one waypoint and disappears and then repeats every single time depending on the amount of enemies I’ve set on the wave asset. I’ve checked everywhere on my codes fixing every single error I made, I even ran into GitHub and tried to find the solution, but, I couldn’t. Somebody help me, please!

Hi,

NullReferenceException means that a reference (“link”) to an instance is missing. If you exposed a field in the Inspector, make sure that it’s not empty. Also make sure that you assigned a prefab from your Assets folder if you instantiate a game object, not a game object from your Hierarchy.

Can your enemies already shoot? If so, it might be that they are shooting themselves when they are instantiated. This is a known issue which gets fixed in one of the following lectures.

1 Like

It worked! Thank you so much!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms