How do I generate a border with tiles on my 120x120 tile map?

Hi! This will be a rather odd question but bear with me here. I have a autogenerated map that is measured at 120x120 tiles (I can fully choose how big it can get) and I wish to generate a border with scripts around that map in order for my player not to be able to escape the map. The map itself is autogenerated and it clears itself whenever I start the game in order to generate properly so I cannot just draw a border because it will disappear as well whenever I generate the map, so I must generate it. How would I go about that?

Thank you! If any there are any questions please let me know!

Can’t you just auto-generate the border as well?

I don’t know what your tiles look like, but you could create a tile that represents a wall/border tile. Then, you use this loop to calculate which tiles are border tiles:

var worldSize = new Vector2Int(120, 120);
var tiles = new Tile[worldSize.x, worldSize.y];

for (int x = 0; x < worldSize.x; x++)
     for (int y = 0; y < worldSize.y; y++)
          if ((x != 0 || x != worldSize.x - 1) || (y != 0 || y != worldSize.y - 1))

          tiles[x, y] = borderTile;