我又开始了一个旧项目(有了新的想法,在Unity中),我被困住了。 基本上我需要很多公共数组(主要是因为它们出现在编辑器中)。有没有办法使用现有的字符串“命名”这些数组? 例如:
string[] arrayNames = new string[]{"FirstArray", "SecondArray", "ThirdArray"};
for (int i=0; i<arrowNames.Length; i++){
//Here i would create the new array using the string
public Sprite[] arrowNames[i] = new Sprite[10];
//Code to populate new array comes here
}
这段代码只是我需要的想法。有人知道这样做的方法吗? 感谢。