public int Laenge = 10;
public int Breite = 10;
public Vector3[] new_Ver = new Vector3[300];
public Vector3[,] new_Ver_s = new Vector3[11,11];
public Vector2[] new_UV = new Vector2[300];
public Vector2[,] new_UV_s = new Vector2[11,11];
void Start () {
int n=0;
for(int l=0;l<=Laenge;l++)
{
for(int b=0;b<=Breite;b++)
{
if(b>1 || l<Laenge)
{
if(b%2 ==1)
{
Debug.Log(l);Debug.Log(b);Debug.Log(n+"f");
new_Ver[n]=new_Ver_s[l,b]; //this is the line where it says theres a bug.
new_UV[n]=new_UV_s[l,b];
n++;
}
}
}
}
它说:
IndexOutOfRangeException:数组索引超出范围
但调试说所有的 indizes 都是零。是因为元素是空的吗?我怎样才能轻松地把东西放在那里?如果我对二维数组做同样的事情,就没有问题。我尝试了一些东西并用一个空的vector3变量替换了new_Uv_s。它仍然是同样的错误。'