I'm creating an array with a list of descriptions (strings) that I need to choose randomly and then assign to a text component in a gamobject. How do I do that? I've created the array but I don't know where to go from there. Can anyone help me with this?
public string[] animalDescriptions =
{
"Description 1",
"Description 2",
"Description 3",
"Description 4",
"Description 5",
};
void Start ()
{
string myString = animalDescriptions[0];
Debug.Log ("You just accessed the array and retrieved " + myString);
foreach(string animalDescription in animalDescriptions)
{
Debug.Log(animalDescription);
}
}