system
January 16, 2012, 7:10am
1
Hi, I am a beginner in Unity in my new job. I am mostly a 3d modeller not much touching too much on the engine.
I just encountered a problem where unity despite changing the screen size. There are still problems where the GUI is cut off but the camera or?
This picture is a capture of the situation.
http://dl.dropbox.com/u/29921726/Screencut.jpg
You need to be drawing your GUI in terms of Screen.height and Screen.width. That way it will never go off the screen, it will instead stretch proportionally!
GUI.Button(new Rect(Screen.width * (1f/6.55f),Screen.height * (0.1f/6.3f),Screen.width * (4.8f/6.55f), Screen.height * (0.85f/6.3f)),“Click”); //c#
GUI.Button(Rect(Screen.width * (1f/6.55f),Screen.height * (0.1f/6.3f),Screen.width * (4.8f/6.55f), Screen.height * (0.85f/6.3f)),"Click"); //java script
this will adjust the GUI depending on screen reslotion