what does this error mean ?

hey all can someone please explain what this error means ?

NullReferenceException
UnityEngine.Camera.ScreenPointToRay (Vector3 position) (at C:/BuildAgent/work/f724c1acfee760b6/Runtime/ExportGenerated/Editor/Graphics.cs:674)
Bullet .Update () (at Assets/FPSScripts/Bullet .js:7)

thank you in advance :slight_smile:

I’m pretty sure thats an error where you haven’t set the reference. It looks like the problem is at line 674 “…/Editor/Graphics.cs:674” maybe you don’t have an object named bullet set up and linked in your hierarchy?

@cidmodder is correct that this occurs when a reference is null, and you’re trying to access either a method or a variable on it. It doesn’t have to be the camera, however. It could also be the Vector3 which ScreenPointToRay takes as argument.

Thankfully, the exception is wonderfully polite in that it tells you precisely which class (Bullet) and which function (Update()) and at what line (7) the error occurred. Go through your code with Debug.Log() and write out all the variables that are used in that Update, and see which one of them was null. Then change the code to make sure it isn’t null. :slight_smile: