TileMap: Paint Border around tiles

Hi, i’m trying to paint a Border around tiles (at runtime), but found no feasible way yet, which is not super clunky.
It should look as I have painted it in the screenshot.

My first idea was to have 6 seperate tiles where one tile represents one line of the border and painting them onto the tiles via script.
This does not work so well, as 6 TileMaps would be needed here as one tile may have 6 Line for the Border… This sounds to difficult to mange at runtime and simply wrong.

Is there a better solution?

Any help is appreciated!

Ok, I was able to solve tihs as follows:

  • Create a function which gets all Vector3 Position of the egdes of eacht tile
  • Filter them, so that all edges which do occur more than 2 times are removed
  • Use LineRenderer to paint the borders. To make sure painting is not a mess, use Vector3.Distance to get the next (nearest) point.

Solution looks as follows:
190286-unbenannt.png