What am I overlooking?

Quick question: What am I overlooking in this piece of code?

	for(var n = 0; n < Blocks.Count; n++)
	{
	    BlockScripts[n] = Blocks[n].GetComponent(BlockScript);
	}

Blocks is an List of GameObjects and BlockScripts is an array of BlockScripts.

GetComponent returns a typeof Component, using the generic version of GetComponent, the return type is the script type you are looking for. Or you could cast it(second example)

for(var n = 0; n < Blocks.Count; n++)
{
    BlockScripts[n] = Blocks[n].GetComponent.<BlockScript>(); //js
    //BlockScripts[n] = Blocks[n].GetComponent<BlockScript>(); //c#
}

Without using GetComponent.< T >();

for(var n = 0; n < Blocks.Count; n++)
{
    BlockScripts[n] = (BlockScript)Blocks[n].GetComponent(BlockScript);
}

This is a guess, you didn’t post an error or exception, if you did you should post it.

Wow. I found the problem. I haven’t set the length of the BlockScripts array. Sorry for wasting your time =P