I want to change a string by randomly choosing an index in an array, using the random.range command in unity. Bare in mind that I'm using strings here, not floats or integers. Here is a code example(not the real thing. I'm just coming up with this by example, but it still has the same meaning. I may make a few typo errors as a result):
public string ChangingString = ("");
public string[]ExampleArray = new string [2];
void Start () {
ExampleArray[0] = ("String1");
ExampleArray[1] = ("String2");
}
void OnGUI () {
if(GUI.Button(new Rect(10,10,100,24), "Randomize text")){
ChangingString = (code to choose random string using the ExampleArray);
}
GUI.Label(new Rect(10,30,100,20), ChangingString);
}
EXTRA NOTE: I'M NEW TO USING ARRAYS.