Is it possible to call a script using onMouseDown function

Hi

Is it possible to call a script using onMouseDown function?

What I would do is wrap the code for the GUI in an if statement, controlled by a boolean variable. When you click on one of the objects, you set that variable to ‘true’ and the GUI should appear.

You were very close, Cadviz, regardless of what your problem was.

I’ve taken the code you posted above and modified only the OnGUI section, this should be close to what you were looking to do, at least.

function OnGUI()
{
	if(_mouseClick)
	{
		if (GUI.Button (Rect (100,570,40,40), "Button 1") )
		{
			Debug.Log("Texture 1 should come up");
			renderer.material.mainTexture = crate_tex1;
			_mouseClick = false; //This part of the code hides the buttons away
		}

		if (GUI.Button (Rect (175,570,40,40), "Button 2") )
		{
			Debug.Log("Texture 2 should come up");
			renderer.material.mainTexture = crate_tex2;
			_mouseClick = false; //This part of the code hides the buttons away
		}

	}
}

So long as you have assigned the textures in the variable slots of the gameobject using the inspector, it should work just fine.

Let us know how you go =)