private void SearchForBlock() { var chunk = World.Chunk; int height = chunk.GetLength(0); int width = chunk.GetLength(1); int yCoord = height / 2 + Mathf.RoundToInt(CurrentMousePosition.y - 0.5f); int xCoord = width / 2 + Mathf.RoundToInt(CurrentMousePosition.x); BlockInstance block = (xCoord >= 0 && xCoord < width && yCoord >= 0 && yCoord < height) ? chunk[yCoord, xCoord] : null; if (block != null) { PrefabRepository.Instance.TxtBlockType.GetComponent <Text>().text = block.ToString(); } else { PrefabRepository.Instance.TxtBlockType.GetComponent <Text>().text = "void"; } }