在Unity中使用C#编程时,为什么不能将数据从一个数组存至另一个数组
pointX和dataArrX都是字符串数组string[]pointX[i] = dataArrX[i]; //运行到这里报错
NullReferenceException: Object reference not set to an instance of an object
收起
你应该是没有给point[i]指定长度吧!
在for循环之前初始化pointX的容量就行 pointX = new string[dataArrX.Length]; 或者你可以用List来存储字符串,直接add,动态分配,就不会有这个问题了
报告相同问题?