public void UpdatePrefabType() { if (prefabChanged) { // Update prefab variable used later in the creating sprites function if (theGraph.graphType == WMG_Axis_Graph.graphTypes.line) { nodePrefab = theGraph.pointPrefabs[pointPrefab]; } else { nodePrefab = theGraph.barPrefab; } // Delete points and lines for (int i = points.Count - 1; i >= 0; i--) { if (points[i] != null) { WMG_Node thePoint = points[i].GetComponent <WMG_Node>(); foreach (GameObject child in thePoint.links) { lines.Remove(child); } theGraph.DeleteNode(thePoint); points.RemoveAt(i); } } // Delete legend if (legendEntryNode != null) { theGraph.DeleteNode(legendEntryNode.GetComponent <WMG_Node>()); theGraph.DeleteLink(legendEntryLink.GetComponent <WMG_Link>()); } } }