/*
Instantiate(Resources.Load(“Blocks/EmptyBlock”)) as GameObject DOES return a GameObject
Something is happening whenever I Add() an element that throws the exception
This is my code:
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Block : MonoBehaviour {
public static List<List<List<GameObject>>> blockGrid;
void arraySetup(List<List<List<GameObject>>> blockArray, int rows, int cols, int depth) {
blockArray[0][0].Add( Instantiate(Resources.Load("Blocks/EmptyBlock")) as GameObject );
Debug.Log(blockArray[0][0][0].name);
}
void Start () {
blockGrid = new List<List<List<GameObject>>>();
arraySetup(blockGrid, 20,20,10);
}
// Update is called once per frame
void Update () {
}
}