Unity Android Game Scripting

I want to know if a script can call multiple text element. I want a script to give random numbers to three text. (I can do the random stuff) I dont know how to manipulate multiple element in a script.

Is this what you mean?

using UnityEngine;
using UnityEngine.UI; //Add this!
using System.Collections;
using System.Collections.Generic; //Add this!

public class TextDisplayController : MonoBehaviour {

    public Text textDisplay; //using UnityEngine.UI; in order to use UI: like 'Text', 'Slider', and more...
    public List<string> textList; //using System.Collections.Generic; in order to use 'List<> ()'...
    private int randomNumber;

    // Use this for initialization
    void Start () {
        GetRandomText ();
    }
 
    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown (KeyCode.Space))
            GetRandomText ();
    }

    void GetRandomText ()
    {
        randomNumber = Random.Range (0, textList.Count);
        Debug.Log ("Text List:" + (randomNumber + 1) + " / " + textList.Count);

        if (textList.Count != 0)
            textDisplay.text = textList [randomNumber].ToString ();
    }
}

3172914--241748--Random Text List Display.png

1 Like

Oh im sorry. I actually found something after some digging.
3172954--241750--Capture.PNG

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChangeN1 : MonoBehaviour {
    [SerializeField]
    public Text txtN1 = null;
    public Text txtN2 = null;
    public Text txtA1 = null;
    public Text txtA2 = null;
    public Text txtA3 = null;
    public int n1, n2, nn, nHolder, nnn;

Anyways. Thanks for the help. :slight_smile: