【发布时间】:2015-07-09 22:20:04
【问题描述】:
我正在创建一个数组,其中包含我需要随机选择的描述(字符串)列表,然后分配给 gamobject 中的文本组件。我怎么做?我已经创建了数组,但我不知道从那里去哪里。谁能帮我这个?
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);
}
}
【问题讨论】: