Problem with EnemyAi system unity keeps giving errors [duplicate]

My EnemyAi system works perfectly but for some reason when I start the game to test it unity keeps giving me errors.

Enemy Ai Script keeps giving me the NullReferenceException: Object reference not set to an instance of an object EnemyAi.Update() error inside unity about the line Vector3 lookDir = target.transform.position - transform.position;

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class EnemyAi: MonoBehaviour {  public bool detected; GameObject target; public Transform enemy;  public GameObject Bullet; public Transform shootPoint;  public float shootSpeed = 10f; public float timeToShoot = 1.3f; float originalTime;  public EnemyAni Animation; public GunAni GunAnimation;  public ParticleSystem muzzleFlash;  public AudioManager Sound;  public PlayerHealth playerHealth;  void Start() {     originalTime = timeToShoot; }  public void Update() {     //makes the enemy rotate on one axis     Vector3 lookDir = target.transform.position - transform.position;      lookDir.y = 0f;      //makes enemy look at the players position     if (detected)     {         enemy.LookAt(target.transform.position, Vector3.up);         enemy.rotation = Quaternion.LookRotation(lookDir, Vector3.up);     }     if (detected == true)     {         Animation.LookPlayer = true;         GunAnimation.ShootPlayer = true;     }      if (detected == false)     {         Animation.LookPlayer = false;         GunAnimation.ShootPlayer = false;     } } 

Enemy character Game Object in the unity inspector:

Enemy Character unity Inspector

Enemy vision Gameobject in the unity Inspector:

Enemy Vision unity Inspector

My organization just to show how everything is attached:

Organization in unity

The error message there are a lot because it’s talking about the other Enemy GameObejcts:

Error Messages