Object reference not set to an instance of an object

I dont understand what is causing the issue.
https://imgur.com/a/jUkfg3C
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.SceneManagement;

public class DogFov : MonoBehaviour
{
    public float fovAngle = 90f;
    public Transform fovPoint;
    public float range = 8;
    public Transform target;
    bool hasSeen;
    bool move;
    [SerializeField] GameObject light;
    [SerializeField] float dogSpeed;

    void Update()
    {
        if(!hasSeen)
        {
            Vector2 dir = target.position - transform.position;
            float angle = Vector3.Angle(dir, fovPoint.up);
            RaycastHit2D r = Physics2D.Raycast(fovPoint.position, dir, range);
            if (angle < fovAngle / 2)
            {
                if (r.collider.CompareTag("Player"))
                {
                    Debug.DrawRay(fovPoint.position, dir, Color.red);
                    light.active = false;
                    hasSeen = true;
                    move= true;
                }
            }
        }
        if(move)
        {
            this.transform.position = Vector2.MoveTowards(transform.position, target.transform.position, dogSpeed);
            if (transform.position == target.transform.position)
            {
                Invoke(nameof(RestartScene), 0.5f);
            }
        }
    }

    private void RestartScene()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
}

This error is the most common error in the whole of programming.

Object reference not set to an
instance of an object


Is a NullReferenceException or Null Pointer Exception.


It means you are trying to access a member (specifically when it is a reference type) on an object that has not been initialised/ instantiated. i.e. one that is null.


It is so common in fact that there are rules in this forum against posting questions about it, because if you read the error message it would tell you exactly what line and character the exception was happening on and the soloution is always the same thing.


Make sure any null objects are initialised before trying to use them.