Hi! Im working on making a dialogue system but can’t figure out how to set my font size relative to the GUI box size, although I did manage to set the size of the GUI box relative to the screen resolution.
var dialogSkin : GUISkin;
var dialogBox : Rect;
var dialogText : String[];
var dialogNumber : int = 0;
function Start () {
dialogBox.width = Screen.width * 0.5;
dialogBox.height = Screen.height * 0.2;
dialogBox.x = (dialogBox.x * Screen.width) - (dialogBox.width * 0.5);
dialogBox.y = (dialogBox.y * Screen.height) - (dialogBox.height * 0.5);
}
function Update () {
if(Input.GetButtonUp("Fire1")){
dialogNumber++;
}
}
function OnGUI(){
GUI.skin = dialogSkin;
GUI.Box(dialogBox, dialogText[dialogNumber]);
}
This is the code I used to define the size of the GUI box. Is there a way to set the font size exactly relative to the GUI box size? I couldn’t think of one since the font size does not have x and y width