|
|
|
| View previous topic :: View next topic |
Mr.Deltar
Joined: 05 Nov 2009 Posts: 2
|
Posted: Thu Nov 05, 2009 9:32 pm Post subject: Background Image is distorting |
|
|
|
I'm new to Unity and I am having a problem with my background image in my main menu. its aspect ratio keeps distorting. Is there an easy way to make it just show the image in the correct aspect ratio? Right now I am using | Code: | var backgroundStyle : GUIStyle = new GUIStyle();
backgroundStyle.normal.background = backdrop;
GUI.Label ( Rect( (Screen.width - (Screen.height * 2)) * 0.1, 0, Screen.height * 2,
Screen.height), "", backgroundStyle); |
I'm not exactly sure what its doing to be honest. |
|
| Back to top |
|
|
Mr.Deltar
Joined: 05 Nov 2009 Posts: 2
|
Posted: Sat Nov 07, 2009 4:57 am Post subject: |
|
|
|
Okay so I got my dimensions issue worked out. But now i'm wondering how do I set it up so that it will scale the image and button placements based on the resolution the application is being run in? The code I have so far is:
| Code: | GUI.Label (Rect( (Screen.width-Screen.width), Screen.height-Screen.height, 1280, 720), "", backgroundStyle);
|
Any help is appreciated. |
|
| Back to top |
|
|
andeeee Forum Moderator

Joined: 19 Jul 2005 Posts: 1603 Location: Blackpool, United Kingdom
|
Posted: Mon Nov 09, 2009 4:51 pm Post subject: |
|
|
|
Check out GUI.DrawTexture as an alternative to GUI.Label. It has an optional parameter specifying how to scale the image - you can keep the aspect ratio fixed. _________________ None of you understand... I'm not logged-in here with you - YOU'RE LOGGED-IN HERE WITH ME! |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|
|
|
|