GUI Texture on bottom left/right corners

Hello everyone. I want to make a 2D texture in the bottom right of the screen. But if I adjust it within the inspector, the position of the 2D Gui Texture can be different according to the resolutions. So I know that it can be arranged with code and suitable for every resolution. I have a code that makes a GUI label on the right bottom but I couldn’t figure out how to make it for drawing a texture.

GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80),"something: ");

this is what I use for creating a text in bottom right corner. I want the same thing for the texture. Can someone lead me to the right way for doing this ? Thanks :slight_smile:

Careful! GUITextures pixelInset properties have their origin at the bottom left of the screen. Just adapt the code you have for GUI.Label accordingly, using GUITexture.pixelInset.x and y. I hope I’m clear!

maybe you can do it by

function OnGUI()
{
GUI.backgroundcolor = Color.clear;
GUI.Box (Rect(Screen.width - 200,Screen.height-35,200,80), myBoxTexture);
GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80), "something: ");
}

:slight_smile:

Use GUIStyle and change it alignment.

        guiStyle = new GUIStyle(GUI.skin.label);
        guiStyle.font = myFont;
        guiStyle.fontSize = 48; //change the font size
        guiStyle.normal.textColor = Color.white;

        guiStyle.alignment = TextAnchor.LowerRight;
        

        GUI.Label(Rect, "Text", guiStyle);