Adjusting resolution not working

Hey,

I’m using this code to resize my GUI for all the other resolutions, but I keep getting errors :

//SCALE NATIVE RESOLUTION VARIABLES
	float native_width= 1600;
	float native_height= 900;

void onGUI{
float rx = Screen.width / native_width;
		float ry = Screen.height / native_height;
		GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1));

....

}

Errors are :

Assets/MyScripts/MenuController.cs(106,45): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected
Assets/MyScripts/MenuController.cs(106,40): error CS1502: The best overloaded method match for UnityEngine.Matrix4x4.TRS(UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Vector3)' has some invalid arguments Assets/MyScripts/MenuController.cs(106,40): error CS1503: Argument #1’ cannot convert object' expression to type UnityEngine.Vector3’

What am I doing wrong here ?

Thank you.

I think you forgot to use the new keyword.

GUI.matrix = Matrix4x4.TRS (new Vector3(0, 0, 0), Quaternion.identity, new Vector3 (rx, ry, 1));

Let me know if that solves your problem.