public Waypoint GetTargetSpace(GameObject target) { RaycastHit2D hit; Waypoint space = null; hit = Physics2D.Raycast(target.transform.position, -Vector2.zero); if (hit.collider != null) { space = hit.collider.GetComponent <Waypoint>(); Debug.Log("Current Tile: " + space.name); space.BreadthFirstSearch(defaultMove, Color.green, true); } else { Debug.Log("Raycast missed"); } return(space); }