Hexagonal Tilemap
Hi, I'm trying to use the Hexagonal Point Top Tilemap for my 2d Hexagon game. So now the problem is that the Grid of the Tilemap has a different size than the Tiles and I don't understand why. So the size of the Tilemap Palette fits perfectly to my Tiles, but like i said the size of the grid is different. The Palette grid and the Tilemap Grid in the Hierarchy even have the same size. And no its not about the size of the Tiles that don't fit inside of a Hex grid, its about the the strange side lenght. I hope you know what I mean :D
Images: Screenshot 1: Screenshot 2:
Answer by Bluetooth4269 · Feb 17, 2020 at 02:57 PM
I've been messing around with this all day and have discovered a few things which I'll share, in case anyone else is looking for the answer to this question.
1) If you look at the Grid in the image above, you'll see that the sides of the hexagons are not even. This is because an even Hexagon is NOT height=1, width=1. You can fix this by going online, looking for a hexagon calculator and adjusting the cell size of the Grid in the Inspector accordingly. In case you're too lazy too look for it yourself, the width to height ratio on a flat-top hexagon is roughly 1 to 0.866 (reverse that for point-top). Or 1.155 to 1, whichever you prefer.
2) If your tiles are the right height-to-width ratio but the wrong size in the Tile Palette, you need to recreate the Tile from your png sprite and change the "Pixels per Unit" setting to be exactly the same as the height and width of your png. You should ensure that the height and width of your original sprite (the .png file) are identical (100x100 for example), as this will make all later adjustments in the Palette and Grid much easier. By this I do NOT mean you should squeeze or widen your hexagon in the png to match the edges. There should be empty space on the right and left or top and bottom of your png file.
3) If for some reason you can't recreate the Tile from png, you can also experiment with the scale in the Tile Palette by choosing the "Select" tool in the Palette (the mouse), clicking on your sprite in the Palette and adjusting the scale in the inspector. This is more annoying to work with though, as the Palette likes to reset the scale to 1 whenever you hit the "Paint" tool and click on your sprite.
Thank you for this, it's obvious once you know why!
This was fixed for me by adjusting the height and width of the grid to use the "correct" ratio between the height and width of a hexagon.
However, this meant that all my sprites were now the wrong size as they had assumed equal heights and widths. This was easily fixed by bulk resizing my sprites with Windows Power Toys:
https://docs.microsoft.com/en-us/windows/powertoys/install https://github.com/microsoft/PowerToys/releases/