GUI Aspect Ratio?

Hiya guys, I was just wondering something. I have several GUI Textures in my scene and I noticed that whenever I run my build in different aspect ratios they disappear due to being cut off the side.

How do I make it so that they stay in the same place regardless of screen size?

Example of my code below:

function OnGUI ()

    GUI.Label (Rect (200, 800, 200, 100), "Bullets Remaining: " +BulletsLeft, customGuiStyle);
    GUI.Label (Rect (200, 840, 200, 40), "Clips Remaining: " +Clips, customGuiStyle);

You should use Screen.width and Screen.height as values for the calculation of your position.

If you want to “dock” an element to a certain position, you could do something like this:

GUI.Label (Rect (Screen.width0.2f, Screen.height0.2f, 200, 100), "Bullets Remaining: " +BulletsLeft, customGuiStyle);

You can also use the that calculation to scale your label accordingly.
Hope this helps :wink: