Layouts with GUITextures

Hi there!

I want to create a GUI with GUIText and GUITexture. I created a simple pad in photoshop and made it to a GUITexture. Now I want to chane its width by code, it has to get the width of the screen. I also want to place GUIText always 5 Pixel left from the roght upper corner.

How could I achieve that? THX!

You don't want to use GUIText and GUITexture as they're somewhat "outdated" (I use that term loosely).

The thing you should be looking at instead is the relatively-new Unity GUI, specifically, GUI.Texture, and GUI.Label.

You could also just create buttons and windows to your liking with each texture and then independently render them on GUI. You actually get a much better look to your GUI if you do things this way. You don't need Skins.

First in your scene create an empty game object, then attach this script to it..

in Java.

<>

var icon: Texture2D; //this is your texture.

function OnGUI(){

GUI.Button(Rect(10,10,100,100),GUIContent(icon)));

} //this creates a variable space in the inspector where you drag and drop your texture.

<>

Attach this script to your empty object, and you are done without using skins.