In unity, as the screen resolution grows, the right and bottom of the screen expands, and as it gets smaller, the right and bottom of the screen decreases in size. I would like to align a GUITexture to the right of the screen, and allow it to stay on the right of the player’s screen without it being hidden if they have the resolution small. How can I do this? Thanks before hand :).
You could try something like this. I made this example using the default Unity Watermark GUITexture. This example is in C#.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
Rect inset;
void Start()
{
inset = guiTexture.pixelInset;
transform.position = Vector3.zero;
}
void Update ()
{
guiTexture.pixelInset = inset;
inset.x = Screen.width - 128;
inset.y = Screen.height - Screen.height;
inset.width = Screen.width / 10.67f;
inset.height = Screen.height / 13.24f;
}
}
Skalde
2
Something like “Screen.width / 1 - 50”