using UnityEngine;
using System.Collections;
public class GUI_Dialogue : MonoBehaviour {
private const float cRefResolutionX = 1920.0f;
public Texture2D icon;
// Use this for initialization
void Start ()
{
}
void OnGUI()
{
float dialIconCenterX = -0.2f;
float dialIconCenterY = 0.18f;
float dialIconSizeX = 0.08f;
float dialIconSizeY = 0.08f;
float dialTextSizeX = 0.35f;
float dialTextSizeY = 0.08f;
// compute GUI scale based on x screen width and reference resolution
float guiScale = Screen.width / cRefResolutionX;
// Face icon GUI box positioning
float dialIconSX = dialIconSizeX * guiScale * cRefResolutionX;
float dialIconSY = dialIconSizeY * guiScale * cRefResolutionX;
float dialIconL = ( Screen.width - dialIconSX ) * 0.5f + dialIconCenterX * guiScale * cRefResolutionX;
float dialIconR = ( Screen.height - dialIconSY ) * 0.5f + dialIconCenterY * guiScale * cRefResolutionX;
// Text box GUI box positioning
float dialTextSX = dialTextSizeX * guiScale * cRefResolutionX;
float dialTextSY = dialTextSizeY * guiScale * cRefResolutionX;
float dialTextL = ( Screen.width - dialTextSX ) * 0.5f + dialIconCenterX * guiScale * cRefResolutionX * -0.1f;
float dialTextR = ( Screen.height - dialTextSY ) * 0.5f + dialIconCenterY * guiScale * cRefResolutionX;
GUI.color = Color.white;
GUI.Box(new Rect(dialIconL, dialIconR, dialIconSX, dialIconSY), icon);
GUI.Box(new Rect(dialTextL, dialTextR, dialTextSX, dialTextSY), "AHHHHHHHHHHHH!");
}
// Update is called once per frame
void Update () {
}
}
The above code gives me this result:
How can I make the text font size bigger and placed in the center (in y-axis) of the text box?
Also, I need to make both boxes stand out more, is there anything that involves with changing the background color or changing the outline color of the boxes?
