0

I am getting error

NullReferenceException: Object reference not set to an instance of an object SinglePoint.Update () (at Assets/Script/SinglePoint.cs:52)

and this is my block of code

     if (Input.GetMouseButtonDown (0)) {

        //line 52 where error exists: Vector3 
        currentPosition=Camera.main.ScreenToWorldPoint(Input.mousePosition);

        currentPosition.z=-5.0f;

        InstatiateCirclePoint(currentPosition,currentLineRenderer.transform);
    }
Programmer
  • 121,791
  • 22
  • 236
  • 328
janice
  • 61
  • 1
  • 8

1 Answers1

0

If this is indeed the correct line of code, you should confirm that you have a Camera added to your scene and that it has the Tag "MainCamera" attached to it.

enter image description here

Shawn Lehner
  • 1,293
  • 7
  • 14