Parameter Name: Index
Index is Less than zero or more than equal to the list count
pragma strict
var block : GameObject; var blockWidth : int = 2; var blockArray : Array = Array();
function Start () {
//Instantiate (block, Vector3(0, 1, 0), Quaternion.identity);
//Instantiate (block, this.transform.position, Quaternion.identity);
for (var i = 0; i > 5; i++);
{
var latestBlock = Instantiate (block, Vector3(this.transform.position.x + blockWidth*i, this.transform.position.z), Quaternion.identity);
blockArray.Add(latestBlock);
Debug.Log("Adding new block to the Array.Reading element " +i + " as " +blockArray[i]);
}
//Debug.Log("Outside the for loop");
}
function Update () { }
Comment
I guess what you want is:
for (var i = 0; i < 5; i++)
{
...
}
Your answer
Follow this Question
Related Questions
C# array error index is zero but when i try to assign it to variable it suddenly change to 3 0 Answers
Finding specific index of an array 1 Answer
How can I find the index of an object in an array from that object's script? 0 Answers
Why does this loop throw an error if int questComplete rises above 1? 0 Answers