Pink screen on ESC

Why does my screen go to pink when I hit ESC.
I am using ESC to signal that the user wants to quit but I want to have him
confirm it with a message.
But the message does not come up … all I get is a pink screen.

	if (Input.GetKey(KeyCode.Escape)){
		tiles.SetActive(false);
		bckGrndPlane.renderer.material = scrnQuit;
		doExperimentSet = false;
		doPracticeSet = false;
		doQuit = true;
	}

In the message I tell them to hit Q if they really want to quit.

	if (Input.GetKey(KeyCode.Q) && doQuit){
		Application.Quit();
	}

But I don’t get the message at all, just a pink screen.

The Escape key is the default Cancel/Quit key in Unity. What’s probably happening is that the game is instantly quitting when you hit Escape and so the material assignment in line 3 has no time to complete, therefore leaving the material unassigned - the pink texture. Try changing the key to something else to see if the same thing happens. Alternatively, change the default key in Unity (Edit > Project Settings > Input - ‘Cancel’ tree).