I am trying to create a timed progress bar that fills over time. This is the script that I created and attached to my fill image. When I run the game I get an error saying "Object reference not set to an instance of an object".
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class timerFill : MonoBehaviour
{
public Image fill;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
fill.fillAmount += Time.deltaTime / 100;
}
}