public Hex GetHexFromPosition(Vector3 a_position) { a_position = transform.InverseTransformPoint(a_position); OffsetCoord offsetCoord = HexCoordinate.PositionToOffset(a_position); int index = offsetCoord.y * MapWidth + offsetCoord.x; if (index < MapWidth * mapHeight) { return(grid[index]); } return(null); }