void HandleInputRight() { Ray inputRay = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(inputRay, out hit)) { { hit.point = transform.InverseTransformPoint(hit.point); TileCell currentCell = grid.GetCell(hit.transform.position); List <TileCell> path = pathfinder.FindPath(selectedUnit.cell, currentCell, true);//cells[Random.Range(0, cells.Count)], true); if (PathGameObject == null) { PathGameObject = Instantiate(PathGOPrefab); } PathGameObject.GetComponent <Path>().path = path; } } }