- Home /
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!
Answer by Ricane · Dec 23, 2021 at 07:30 AM
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:
Your answer
Follow this Question
Related Questions
Making a 2D 16-bit game. 0 Answers
Who knows this crash,this crash from google store 0 Answers
2d 16 bit Tilesets to unity? 2 Answers