Tilemap with sprite mask

I have some tall sprites extending outside the bounds of the tilemap and I would like to trim the tops so that it remains contained. Here is a corner of my tilemap:

It seems there is a Mask Interaction option on the tilemap renderer. I have tried various combinations of Visible Inside Mask and attaching a Sprite Mask component to various game objects, but to no avail. I have also tried using the regular Mask component, but that didn’t change anything. Searching the nets I did not find anyone showing how to properly combine these two components.

Any ideas?

Is it really necessary and requires your intervention? Everything looks good.

create a new game object

add the sprite mask component

set the sprite on the sprite mask to something like a rectangle

click on the game object and move it above the part of the map you want to cut out

change the interaction on the tilemap to visible outside mask

Thank you flasker, you have pointed me in the right direction. This is what worked for me in the end, in case anyone else gets stuck:

  • Create a sprite mask in your scene as a game object, give it a square sprite (should be available by default)
  • Set its position to 0,0 and give it width,height as scale (e.g. my map is 500x500 tiles with 1 tile = 1 unit so I just simply set scale to 500,500)
  • Set the tilemap renderer’s Mask Interaction to Visible Inside Mask