NullReferenceException when attempting to call Method i another script.

In GUIScript I have:

var controllerScript : ControllerScript;

function start () {
controllerScript = GameObject.Find("ControllerHolder").GetComponent(ControllerScript);
function OnGUI () {
	if (GUI.Button (Rect (10, 20, 100, 200), "Play")) {

In ControllerScript.js I have:

public function playBlock() {

and this script is a component of the Empty Object “ControllerHolder”.

It compiles fine but when I click the Play Button I get:

NullReferenceException: Object reference not set to an instance of an object

Any help would be appreciated.

Thanks for your comments and interesting exploration of the cost of “Find()”. I’m still not sure how I can get GUIScript to call playBlock()?

I’ve managed to sort this out now by reading Duck’s very clear explanation of “Dragged References” at:

I had been trying to drag my script into the variable rather than the GameObject which contained the Script.