How to get Tile instead of TileBase from TileMap

Hello all,
In my script, I’m wanting to get the Tile at a certain location in the TileMap. However, there only seems to be methods to get the TileBase, which as far as I can tell, is pretty useless.

Tile getTile(TileMap tileMap, Vector3 pos) { 
   Vector3Int tilePos = tileMap.WorldToCell(pos);
   var tile = tileMap.GetTile(tilePos);

   return tile;
}

This, of course, doesn’t work, because GetTile only returns the TileBase.
You can specify a T for GetTile, but

var tile = tileMap.GetTile<Tile>(tilePos);

comes back with an error saying you can’t implicitly convert a TileMap to a Tile.

I’ve been at this for hours, and can’t find any solution. I have no idea why Unity would return the TileBase when there’s next to nothing you can do with it, but make the Tile itself almost impossible to get.

Thanks for any help.

After searching some more, I may have the answer now, it works for me: Tile tile = Tilemap.GetTile<Tile>(position);

Give it a shot if it’s still relevant.

UPD: Oops. Just noticed that you did try that. Well, it does work at my side now, maybe Unity had introduced some changes. I’m definitely getting Tile, not TileBase.

I’ll make this into answer to help anybody else in the same situation.

I was also able to directly convert TileBase to Tile

exampleTilemap.GetTile(exampleVector3Int) as Tile

or

(Tile)exampleTilemap.GetTile(exampleVector3Int)

Unity 2021.3.12f1