private void Populate() { objectPool = new List <Element>(); linePool = new List <LineScript>(); foreach (ElementData ed in GameHandler.dataHandler.GetElementData(currentExpression)) { GameObject go = Instantiate(GameHandler.objectHandler.elements[(int)ed.type], panels); go.transform.localPosition = new Vector3(ed.positionX, ed.positionY, 0.0f); Element e = go.GetComponentInChildren <Element>(); e.SetData(objectPool.Count, this); ReLabel(e); objectPool.Add(e); } int currentElement = 0; foreach (ElementData ed in GameHandler.dataHandler.GetElementData(currentExpression)) { for (int i = 0; i < ed.inputs.Length; i++) { if (ed.inputs[i] != null) { // Add line // TODO - Make special line for bools GameObject go = Instantiate(GameHandler.objectHandler.line, lines); LineScript ls = go.GetComponent <LineScript>(); ls.SetConnect1(objectPool[currentElement].GetHandels()[i]); ls.SetConnect2(objectPool[GameHandler.dataHandler.GetElementInputDestinationIndex(currentExpression, currentElement, i)].GetHandleOut()); ls.SetPlaced(false); } } currentElement++; } }