Unity and C #. Change FontSize of a JSON text

1

Within OnGUI() I have:

GUILayout.BeginArea(new Rect(75, 500, 900, 200));

Inside, I take the JSON and show its contents:

GUILayout.Label(json[0][0][textInComp][0].Value, GUI.skin.textArea);

And I finish:

GUILayout.EndArea();

Does anyone know how to change the text size from within Label ? Which one I take from the JSON.

Thank you.

    
asked by DarthDev 20.10.2016 в 10:17
source

1 answer

1

You can create a new GUIStyle for that particular text and do the following:

private GUIStyle myStyle;

private void Start()
{
    myStyle = new GUIStyle();
    myStyle.fontSize = 20; // Aquí pones el tamaño de fuente deseado
}

private void OnGUI()
{
    GUILayout.BeginArea(new Rect(75, 500, 900, 200));
    // Le pasas el nuevo estilo como argumento
    GUILayout.Label(json[0][0][textInComp][0].Value, myStyle);
    GUILayout.EndArea();
}
    
answered by 12.12.2016 / 15:25
source