GUI.matrix Input.mousePosition

Hi people,

I’m trying to draw a button in the screen when I put the mouse over an object. In addition I want to apply GUI.matrix to adapt each resolution.
If I don’t apply the GUI.matrix it works well but if I want to do the GUI.matrix then de coordinates of button are wrong.

Any solution?

Thx

This is the code:

function OnGUI(){
	if( dibuixaGUI ){
		var scr : General = Camera.main.GetComponent(General);
		//GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3 (Screen.width / scr.nativeHorizontalResolution, Screen.height / scr.nativeVerticalResolution, 1));
		GUI.Button (Rect(Input.mousePosition.x,Screen.height - Input.mousePosition.y,150,185),"");
		MostrarEstats(Input.mousePosition.x+11,Screen.height - Input.mousePosition.y);
	}
}

I’ve solutioned the problem using this function:

GUIUtility.ScreenToGUIPoint

You can close this post.

Thank you