|
Hello the title says it all. I have a GUITexture and it is transparent in the middle i am using as a HUD. It works fine, but is too small and also, if i build the game and run it on different PC with a different screen size, how can i auto adjust it to fit the screen. Please help, it is greatly appreciated :)
(comments are locked)
|
|
You can use Screen.width and Screen.height to find the screen width and height. And a PROTIP: Instead of defining controls in a hardcoded way like or even the GUILayout class (look in the script reference in [Menu]->[Help]->[Scripting Reference]. But where do I edit the size of the GUI Texture? There is only pixel inset, which is location on screen, not size.
Dec 30 '11 at 02:45 AM
joeybbb
Sorry, what I meant was: the height and width values dont let me type in letters, only numbers, so how do I type in screen.width etc???
Dec 30 '11 at 11:08 AM
joeybbb
You do this via scripting so: function OnGUI () { //stuff here }
Dec 30 '11 at 03:13 PM
macweirdo
Ok thanx. So I havent done any GUI Scripting before do I need to attach the finished script to the GUI Texture or anything in the scene
Jan 01 '12 at 03:17 AM
joeybbb
Attach the finished script on any object in the scene. Just remember which one it was.
Jan 01 '12 at 02:53 PM
macweirdo
(comments are locked)
|
|
Lets say you position it at the center of a smaller screen. You set the x position as 550 and the y as 550. This is a better solution. Screen.width / 2 for the x and Screen.height / 2 for the y. You might want it a little altered depending on what you use it for. (Screen.width / 2) - 50 for x or something like that. Hope it helps
(comments are locked)
|
