private void GenerateBarGraph () { if (barGraph == null) { barGraph = gameObject.AddComponent<BarGraph> ().GetComponent<BarGraph> (); //first object must be target, then default barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_target_string, manager); barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_default_string, manager); //followed by all of the player's prior attempts for (int i = 0; i < attemptCount; i++) { barGraph.InputToCSVObject (attemptList [i].csv_string, manager); } } barGraph.SetActive (true); }