Hello. Someone gave me this code to fix a GUI/resolution problem in my game. It takes the resolution that I developed my game in and scales the positions so that it will look correct at any resolution(I foolishly placed my GUI elements using absolute pixel positions). My problem is, I don’t know where to put the code. Do I put it in every GUI function?
You put it at the start of every OnGUI() function on any script that has one.
That said, your code doesn’t seem to declare what origWidth origHeight is supposed to be so made sure you declare that in your scripts and have them se correctly.
Maybe go back to the person that gave you this code and ask them about how to implement it if you are having trouble.
Okay, I got that piece of code working with no errors, but I have a (new?) problem. The camera in my game gets distorted, its as if it is moved out(the GUI textures are all still displaced), any ideas?