public void AddTrashToRoad(Waypoint w1, Waypoint w2) { if (w1 == null) { Debug.Log("Waypoint1 null in AddTrashToRoad in FlowManager"); return; } if (w2 == null) { Debug.Log("Waypoint2 null in AddTrashToRoad in FlowManager"); return; } List <Road> roadListToCheck = waypointKeys[w1]; Road roadToUse = null; foreach (Road r in roadListToCheck) { if (r.ReturnWaypoint1() == w2) { roadToUse = r; break; } else if (r.ReturnWaypoint2() == w2) { roadToUse = r; break; } } if (roadToUse == null) { Debug.Log("No road found in AddTrashToRoad in FlowManager"); return; } roadToUse.AddToTrash(); }