void Start() { trail = memoGraphic.GetComponent <TrailRenderer>(); // initialize neurons for (int j = 0; j < layerCount; j++) { for (int i = 0; i < neuronsPerLayer; i++) { Neuron neuron = new Neuron(i, j, neuronGraphic); neurons[(j * neuronsPerLayer) + i] = neuron; } } neuronGraphic.GetComponent <MeshRenderer>().enabled = false; // copy first layer neuron to array System.Array.Copy(neurons, 0, neuronFirstLayer, 0, neuronsPerLayer); // find firt nodes for memos Memo.SetPointerNeurons(neuronFirstLayer); for (int i = 0; i < memoCount; i++) { Memo memo = new Memo(memoGraphic); //memo.obj.GetComponent<MeshRenderer>().enabled = false; memo.InitializeTriBuffer(); memo.crystal = new Crystal(crystalGraphic); memos.Add(memo); } // construct neuron child and parent relation graph for (int j = 0; j < layerCount - 1; j++) { Neuron[] neuronsThisLayer = new Neuron[neuronsPerLayer]; System.Array.Copy(neurons, (j + 1) * neuronsPerLayer, neuronsThisLayer, 0, neuronsPerLayer); for (int i = 0; i < neuronsPerLayer; i++) { Neuron neuron = neurons[(j * neuronsPerLayer) + i]; neuron.ChooseChildNeuron(neuronsThisLayer); } } }