宏英(홍잉) 2022-03-24 10:38 采纳率: 0%
浏览 143
已结题

Index was outside the bounds of the array.

出现了这样的错误
IndexOutOfRangeException: Index was outside the bounds of the array.

什么问题导致的呢,解决的思路请详细说明

for (int i = 0; i <= 32; i++)

        {
            float x = float.Parse(points[0 + (i * 3)]) / 100;
            float y = float.Parse(points[1 + (i * 3)]) / 100;
            float z = float.Parse(points[2 + (i * 3)]) / 100;
           
            Body[i].transform.localPosition =  new  Vector3 (x,y,z);
  • 写回答

3条回答 默认 最新

  • CSDN专家-link 2022-03-24 10:46
    关注

    for(int i=0;i<32;i++)
    应该不能等于32的。一般要特别注意循环结束条件

    评论 编辑记录

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 4月14日
  • 创建了问题 3月24日