I got this code
if (Input.GetMouseButton(0)){
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
......
}`
it works with other project that I created but when I tried to implement it with my new project it returns a nullReferenceException.
NullReferenceException
UnityEngine.Camera.ScreenPointToRay (Vector3 position) (at C:/BuildAgent/work/300357e52574df36/Runtime/ExportGenerated/Editor/UnityEngineCamera.cs:276)
Ball.Update () (at Assets/Scripts/Ball.js:51)`
error pointing to this part var ray = Camera.main ..... I tried to add light with the scene but still it's not working. Please tell me what will be the solution. by the way the whole code intended to move or dragged the object/ball.