GUI problem (game breaking bug)

Hello. I am using this bit of code to scale the GUI elements in my game(I placed the GUI stuff using absolute pixel positions). I am having a problem with it. Even though some of the GUI elements appear to scaling properly(as in the button texture from the GUI skin is the right place), when I click on some of the space in buttons, they do not work(this is related to the resolution, as the buttons work fine normally). This also happens with placing textures. What is wrong?

GUI.matrix = Matrix4x4.Scale(Vector3( parseFloat(Screen.width)  / 972, parseFloat(Screen.height) / 636));

Thanks

Anyone?

A few quick questions:

  • Are you running this an OnGUI() function? If not, it won’t respond as you’re expecting, as in, at all.

  • Did you notice that you’re passing Scale a Vector3, that is actually a Vector2? A Vector3 has 3 elements, hence the name. Also, if you’re trying to pass it 0 for ‘z’ that also won’t work, as it needs a non-0 number.

Also, I did a quick google search, and found this: Older Matrix Scaling Issues

They might be some help. Good luck!

It is already in the OnGUI() function, and I tried making it a Vector2, and nothing changed :frowning: