I get these 3 errors but I don’t understand why, please help
Error 1: NullReferenceException: Object reference not set to an instance of an object
Recordatorio.Start () (at Assets/ScriptGuardarCargar/Recordatorio.cs:20)
Error 2: NullReferenceException: Object reference not set to an instance of an object
Recordatorio.OnTriggerEnter (UnityEngine.Collider other) (at Assets/ScriptGuardarCargar/Recordatorio.cs:33)
Error 3: NullReferenceException: Object reference not set to an instance of an object
Recordatorio.OnTriggerExit (UnityEngine.Collider o) (at Assets/ScriptGuardarCargar/Recordatorio.cs:42)
[FONT=Helvetica]using System.Collections;[/FONT]
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class Recordatorio : MonoBehaviour
{
// bool active;
// Canvas canvas;
public Image Imagen;
void Start()
{
// canvas = GetComponent<Canvas>();
// canvas.enabled = false;
Imagen = GetComponent<Image>();
Imagen.enabled = false;
}
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
// Imagen = GetComponent<Image>();
Imagen.enabled = true;
Debug.Log("Entraste!");
}
void OnTriggerExit(Collider o)
{
if (o.CompareTag("Player"))
{
// Imagen = GetComponent<Image>();
Imagen.enabled = false;
Debug.Log("saliste");
}
}
}