private void WaypointColorUpdater(string waypoint, string type) { GameObject w = GameObject.Find(waypoint); Waypoint wp = w.GetComponent <Waypoint>(); if ((wp != null) && type == "adding") { wp.ColorUpdateAdd(); } if ((wp != null) && type == "prev") { wp.ColorUpdatePrev(); } if ((wp != null) && type == "curr") { wp.ColorUpdateCurrent(); } }