NullReferenceException

Game is working perfectly fine until i add Coroutine After it game is giving me a NullReferenceException Error


Here’s The Code Which is Causing the error Don’t know what’s going wrong in this code we simply enabling the particle emission if enemy is in the range. Please tell me what is going wrong. it seems like I’m the only one who’s having this error.

Hi,

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.


See also:

it referring to the particle emission as it written in the code and inspector is perfectly fine no field is empty i have checked

What happens if you remove the coroutine? Does the particle system work again? If so, the problem might be in the coroutine. Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?

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

Privacy & Terms