小编din*_*ght的帖子

Unity C#-数组索引超出范围

我在统一方面遇到麻烦,这是代码

错误信息:

IndexOutOfRangeException: Array index is out of range.
Sequence.fillSequenceArray () (at Assets/Scripts/Sequence.cs:43)
Sequence.Start () (at Assets/Scripts/Sequence.cs:23)
Run Code Online (Sandbox Code Playgroud)

码:

public int[] colorSequence = new int[100];
public int level = 2;

// Use this for initialization
void Start () {
    anim = GetComponent("Animator") as Animator;
    fillSequenceArray ();
    showArray (); // just to know

}

// Update is called once per frame
void Update () {

}

public void showArray(){
    for (int i = 0; i < colorSequence.Length; i++) {
        Debug.Log ("Position " …
Run Code Online (Sandbox Code Playgroud)

c# arrays unity-game-engine

5
推荐指数
1
解决办法
5501
查看次数

标签 统计

arrays ×1

c# ×1

unity-game-engine ×1