While coronavirus strikes, I am forced to stay home to keep social distancing. Well, it’s quite boring at home, therefore I decided to learn something new — making a 2D game in Unity.
Though I teach Game Development at school, there are always areas that I have never visited before. This time I want to learn about Hexagonal Tilemap, which was introduced in Unity 2018.2.
Let the Day 1 begin!
A good thing about Unity is there is a wide range of assets available in their Asset Store, and some of them are free! To start with, I created a 2D project in my Unity 2019.2 in my super slow MacBook Pro (2012 version, it’s 8 years old now!). Then I download the following free asset:
2D Hex Sprites - Hexagonal Tile Setup | 2D Environments | Unity Asset Store
Elevate your workflow with the 2D Hex Sprites - Hexagonal Tile Setup asset from RRFreelance / PiXelBurner. Find this &…
The graphics look really amazing, and the asset pack comes with a lot of extra objects such as trees, rocks, and benches (also a sample scene!).
Aw… wait. Unity asks me to update the version. Okie. Let me spend 2 hours to update Unity to 2019.3.9f1. Grab a beer, no, a dozen beers before the update is finally done.
To create my very first hexagonal tilemap, it’s not as easy as you think. By default, Unity does not come with 2D Tilemap Editor and 2D Sprites packages, which you have to download from Windows > Package Manager.
Wait, what? The Package Manager reports an error that the packages cannot be loaded? Since Unity 2019.x, this Package Manager becomes buggy. To resolve the problem, I have to smash the reload button in the Package Manager a couple of times in order to get it to load up the package list. If you cannot see the 2 mentioned packages, reload until you see it. Click the Install button of course.
After the package is installed, 2 new panels called Tile Palette and Sprite Editor will be available at Windows > 2D. There is no rush to open these panels, you will need them later.
In the same Package Manager, select All packages at the top and change to My packages. Here you will find the package you purchased/added to your asset list. Oh wait…?
Looks like I bump into a bug, again. No matter how many times I click the Reload button, the package content still fails to load, results in the above screenshot. Damn. How come Unity is so buggy? I don’t even start creating my Hexagonal Tilemap at all; the Unity bugs make me almost given up.
To fix this problem, I decided to close all the Applications, reboot the Mac, and… voila! It works again! Tell ya, REBOOT CAN SOLVE 99% PROBLEMS!
I punch the Install button of the 2D Hex Sprites package in the Package Manager, and the package is finally in my Project Hierarchy. Let’s start making great games!
To create the tilemap, go to the Unity menu: Game Object > 2D Objects > Hexagonal Point Top Tilemap. You may ask what is the difference between Point Top and Flat Top? The following image explains the differences:
I choose Point Top, as I think it’s more visually appealing. Alright, move on. After added the Hexagonal Point Top Tilemap, there are 2 items appearing in your Scene: Grid and Tilemap as the child. Open the Tile Palette panel via Windows > 2D > Tile Palette (finally!).
If you installed the 2D Hex Sprite correctly, you should see a palette named “HexPalette_Blank” already been loaded.
Let’s not rush to apply the tiles. There are a couple of things that we have to learn before we can use the tiles. Let me explain… tomorrow.