How do you change the Strings/Ints retrieved from a serve into a text field on the scene? Or what gameObject should I be using?

Im retrieving data from a server, what type of game object should i use to display the retrieved information? Or can you do that with a text field?

Follow up question, is there a way to specify the font and size of the given data from the server?

You will need to use a Text object in the scene: In the menu click GameObject/UI/Text.

This will create a Canvas in your scene (if you don’t already have one). The new Text object will be a child of this Canvas.

You must now set a reference inside a script, to this Text object in the scene, in order to set its “text” property. So, create a public variable of type “Text”:

using UnityEngine.UI;  //needed to use Text type

public DataDisplay:  : MonoBehaviour {

public Text DataText;  //Drag and drop the Text object in the scene to this field in the Inspector

void Display(int dataInt){

DataDisplay.text = dataInt.ToString();


void Display(string dataString){

DataDisplay.text = dataString;


void Display(int dataInt, string dataString){

DataDisplay.text = dataInt + dataString;



Then you can create suitable Display() methods in order to set the values retrieved from the server to the Text object’s ‘text’ property (as illustrated in the above example).

You can set the font and size of the displayed text, in the relative fields of the Text object in the Inspector.