How to draw a line around a hexagon

Hey so I’m creating a game with a hexagon map where you can build buildings but how do I make so there come a line around every single hexagon so I can see where I can build?

GameObject → 2D Object → Tilemap

Set it to Hexagon type of map

If your world is FLAT, it’s actually pretty easy.

Make a texture with a repeating grid of hexagons (you can probably find some tutorials on how to do it online, or even grab a pre-made one). Make sure the background is transparent. Ideally, the colour of the hexes should be white (if it’s black, you can invert the colours).

Add a 3D ‘Plane’ to your scene and place it just above your ground plane.

Create a new material for the plane, and use the texture you created earlier, making sure it’s transparent. I usually use one of the Alpha Blended particle shaders for this rather than the standard shader.

Assign the material to your plane, and then you’re ready to go. You can adjust the tiling of the texture until it matches the size of your game tiles. If your texture was white, you can adjust the colour in the material, which is handy (it’s easy to make it green, red etc.).

The joy of this is that you get a huge number of hexes for just two triangles.

If you want to then light up a single hex, you use a much smaller plane that is exactly one hex grid across and has a texture with just the single hex.

If your world is not flat, that’s a different thing all-together. I’d be very tempted to do it with a custom shader in that case.