Hi! i don't know how to solve this error. "object reference not set to an instance of an object"

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class HealthManager02 : MonoBehaviour {

public static float health;
public Slider healthBar;
public int maxHealth;
private int delayTime;
public int healthDecrease;
public int delay;
private GameObject death;

// Use this for initialization
void Start () {
	healthBar = GetComponent<Slider>();
	health = maxHealth;
	health = 100;
	death = GameObject.Find ("Cell");

// Update is called once per frame
void Update () {
	healthBar.value = health;

void OnTriggerStay2D(Collider2D other){
	if (other.tag == "SunLight" && health < 100) {
		health = health + 0.14f;

public void giveEnergy(int energyToGive){
	health += energyToGive;

public void giveDamage(int damageToGive){
	health -= damageToGive;

IEnumerator waitToSeconds(float delay){
	health -= 0.08f;
	yield return new WaitForSeconds(delay);


It basically means that 1 of the objects you are trying to access is null or not set to anything. A wild guess would be that "healthBar " isn’t actually set to anything so try having a look at that.

Would be easier if you would mention which line actually gives you this error.