Object reference not set to an instance of an object - C#

Hi,

I’m a little new to programming and am trying to call one function from another script in another when I click on an object in the world. When I click on the object, I get the above error on line 9 of the PickUp.cs. Could someone please explain what I’m doing wrong? Thank you. Here’s the code.

using UnityEngine;
using System.Collections;

public class PickUp : MonoBehaviour {

	public GUI_Display display;

	void OnMouseDown(){
		display.pickup();
		Destroy (this.gameObject);
	}
}

using UnityEngine;
using System.Collections;

public class GUI_Display : MonoBehaviour {
	
	private int box_count = 0;

	
	public void pickup(){
		box_count += 1;
	}
}

Um. Its exactly what it says it is.

You declare the variable "display’ but you never set it to anything.

Until you assign a reference to an actual object instance, it is null.

I would guess you are expecting to set it in the editor, but you didn’t.

I have to be honest Im not really clear what you hope this code will accomplish.