ScreenPointToRay

Can someone please help. i have this gun script that uses raycasting to shoot. it worked prefectly on my other project but when i imported it to the project that iam currently developing (witch is an online muliplayer project) it sent me an error when i launched it :

NullReferenceException
UnityEngine.Camera.ScreenPointToRay (Vector3 position) (at C:/BuildAgent/work/842f9557127e852/Runtime/ExportGenerated/Editor/UnityEngineCamera.cs:267)
gun.Update () (at Assets/gun.js:10)

From the limited info given in the question it seems like you forgot to set a reference in the inspector or change a property name.

It’s really hard to say without seeing the script but what that error may mean is when Unity tries to run UnityEngine.Camera.ScreenPointToRay () on line 10 of your script Assets/gun.js that whatever you are passing what you think is a Vector3 object but when the code runs is null. Sometimes adding Debug.Log() statements near the offending line and logging the variables to see if they really are what you think they are can help in finding where the problem actually originated.