I want to display some life info and other menu options, how should I do this? I tried using OnGUI, but it wouldn’t change size on my mobile device. Are there any other alternatives?
You need to put a little bit of work into it to change size. I’ll give a very simple example in C#.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
Rect rect;
string label = "GUI Box";
void Update()
{
//My original box is 256 x 256 pixels in 1366 x 768 resolution.
//I Divide 1366 by 256 to get 5.34. Then I divide Screen width by this sum to keep the aspect ratio.
//I do the same with the height. 768 / 256 = 3, so Screen.height / 3 to keep aspect.
//This will keep the box the correct size no matter what device or res you're using.
if(rect != new Rect(0, 0, Screen.width / 5.34f, Screen.height / 3))
rect = new Rect(0, 0, Screen.width / 5.34f, Screen.height / 3);
}
void OnGUI()
{
GUI.Box(rect, label);
}
}