Exemplo n.º 1
0
    Vector3Int GetTilePosUnderMouse()
    {
        Tilemap tilemap = WorldRenderer.GetTilemap();

        if (tilemap == null)
        {
            return(Vector3Int.zero);
        }

        Vector3    mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector3Int coordinate    = tilemap.WorldToCell(mouseWorldPos);

        return(coordinate);
    }