Alice Hinton-JonesMarch 18, With the release of Unity The new Tilemap features provide a fast and performant way to create 2D environments based on isometric and hexagonal grid layouts, the likes of which are seen in many game classics, including the first entries of the Diablo and Fallout franchises, Civilization, Age of Empires, and many more. Both features build on top of the existing Tilemap system introduced back in Unity They are also natively integrated into the Editor.
In further Unity releases, they might be moved to the package manager. Before we start working with Tilemap, it is important to set up our project correctly. Isometric Tilemap works with 2-dimensional sprites, and it relies on correct renderer sorting in order to create the illusion of a top-down isometric view. We need to make sure that the tiles that are further away from the viewer get painted first; and those that are closer painted on top of them.
However, all of our 2D tiles are actually on the same Z plane. Instead, we can determine which tiles are behind or in front by using their height on screen, rather than their depth.
Tiles which are positioned higher on the screen will be sorted behind those which are placed lower. You can read the relevant Unity Documentation page for 2D sorting if you want to learn more about how it works. In some cases, you may also want to adjust the Z value of your Transparency Sort Axis. We will cover this in more depth later on in this blog post. The Tilemap feature consists of several components working together. The first two are the Grid and Tilemap Game Objects.
To create a Grid, simply right-click anywhere in the Hierarchy, go to 2D Object, and select the type of Tilemap you wish to use. By default, each new Grid is created with one child Tilemap Game Object of the corresponding type. The currently available Tilemap types are as follows:. Tilemap — creates a rectangular Grid and Tilemap. Hexagonal Point Top Tilemap — creates a Hexagonal Grid and Tilemap, where one of the vertices of each hexagon is pointing upwards. Hexagonal Flat Top Tilemap — another Hexagonal Grid type, where the top of the hexagon is an edge which is parallel to the top of the screen.
The last two types, Isometric and Isometric Z as Ycreate two different implementations of the isometric grid. The difference between them arises when simulating different tile elevation levels, such as when we have a raised platform in our Isometric level.
A regular Isometric Tilemap is best used when you wish to create separate Tilemap Game Objects for each individual elevation level of the tiles.
In the case of an Isometric Z as Y Tilemapthe Z position value of each tile works in combination with the custom Transparency Axis Sort setting to make the tiles appear as stacked on top of one another. When painting on a Z as Y Tilemap, we dynamically adjust the Z setting on the brush to switch between different heights. Feel free to grab it — completely free — and have some fun creating your own environments!
To start painting on a Tilemap, you also need a brush and a palette. A Tile Palette is what holds your tile assets, after which you can pick them with the brush tool and start painting. Make sure to set the grid type that corresponds to your use case. For this example, I will be using a regular Isometric Tilemap; as well as the assets from our Isometric Starter Kit project. Set the palette cell size to Manual to be able to customize the dimensions of your isometric tiles.
In this case, I know that the dimensions of my tiles correspond to a grid of 1 in X and 0. You might be unsure about the correct import settings and tilemap size that will work for your assets. There is a general rule that you can follow here based on your initial asset dimensions.
First, take a look at the resolution of your tiles. However, the width will always be the same between them. Therefore, if you want your tiles to take up exactly one Unity unit, set the Pixels Per Unit value in the tile import settings equal to their width in pixels.Discussion in ' General Graphics ' started by PhanixisFeb 2, Search Unity. Log in Create a Unity ID. Unity Forum. Forums Quick Links.
Asset Store Spring Sale starts soon! Unite Now has started! Come level up your Unity skills and knowledge. Joined: Oct 19, Posts: I want to create a hexmap for a strategy game. To do that, I want to make a hexagon tile prefab.
Ideally, this object would be transparent accept for the boarders, although the object does need to be a complete solid hexagon for UI purposes. As none of the 2d or 3d default objects in unity provide are hexagons, what would be the best way to go about creating a hexagon tile graphic for a hexagon prefab? Thanks for the help.
Last edited: Feb 2, PhanixisFeb 2, Joined: Jan 14, Posts: Is your game 2D or 3D? If it is 2D, you can use a program such as Photoshop or GIMP which is very similar to photoshop but totally free to create this graphic yourself.
How do I make hexagon grid? Like civilization? using unity its own tile map and palettes?
There are tons and tons of tutorials online. If you want an actual 3D hexagon, a 3D modeling program like Blender again free, with many tutorials online would be your best bet. The game will be in 3D. Am I going to need to make a hollow 3d model of a hexagon, or is there a way to make the model transparent and have only the edges outlined so that you are only seeing the hexagon borders?
How about drawing a model using code? It's just six lines connected six vertices. The only problem I see here is I want each tile to independently register mouse clicks.
Working with Hexagonal and Isometric Tile Shapes
Oh man I totally disappeared for a while, sorry about that. Maybe you've already figured this out but I'll reply just in case. You can make a regular hexagonal model, and then use a translucent texture, yes. Just set the texture on the Material on the hexagon to Fade. Drawing using code would be possible, but could be tedious. You must log in or sign up to reply here. Show Ignored Content. Your name or email address: Password: Forgot your password?Provide a name for the Palette and select the Create button.
Select a folder to save the Palette Asset file. The newly created Palette is automatically loaded. Drag and drop Textures or Sprites A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development.
More info See in Glossary from the Assets Any media or data that can be used in your game or Project. An Asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image.
More info See in Glossary folder onto the Tile Palette. Choose where to save the new Tile Assets. At the bottom of the Tile Palette window is the Z Position brush editor.
This allows the editing of the Z-axis values of Tiles, which can be used to adjust Tile heights when painting on a Z as Y Tilemap. Refer to the documentation on Adjusting the Tile height in the Palette for more information. The Palette tools used to paint Tiles onto Tilemaps can also be used to edit the placement of Tiles in the Palette itself. Select a Palette from the drop-down menu, then click Edit to unlock the Palette for editing. Refer to the documentation on Painting on Tilemaps for the shortcuts and functions of the Palette tools which can also be used to edit the Palette.
Version: Language : English. Unity Manual. Unity User Manual Creating Tilemaps. Hexagonal Tilemaps. Publication Date: Select the Grid layout the created Tile Palette will be used to paint on. Select this if creating a Palette for the default rectangular Tilemap A GameObject that allows you to quickly create 2D levels using tiles and a grid overlay. More info See in Glossary. Select this when creating a Palette for a Hexagonal Tilemap. Select this when creating a Palette for a Isometric Tilemap.
Select the type of Hexagonal Tilemap that the Palette will be used to paint on. Refer to the documentation on Hexagonal Tilemaps for more information. By default, 1 Unity unit is 1 meter. See in Glossary and based on the size of the Sprite used to create the Tile Assets. If there are multiple Tiles, the Cell Size is adjusted to match the first Tile from the bottom left of the Palette, so that it fits exactly on a cell.Tiles A simple class that allows a sprite to be rendered on a Tilemap. An Asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image.
More info See in Glossary that are arranged on Tilemaps A GameObject that allows you to quickly create 2D levels using tiles and a grid overlay. More info See in Glossary to construct a 2D environment. Each Tile references a selected Sprite A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development.
Version: Language : English. Unity Manual.Hex Grid Movement with Tilemap in Unity! (Tutorial)
Unity User Manual Tilemap Renderer. Creating Tiles. Publication Date: Displays a visual preview of the Tile with the selected Sprite.
Select the Sprite texture to be rendered on this Tile. Click the circle icon to the right to open the object picker window to select from the available Sprite Assets, or drag a Sprite directly onto this box. Tints the Tiles placed on this Tilemap with the selected Color. When set to white, the Tiles are rendered with no tint.
Defines the shape of the Collider An invisible shape that is used to handle physical collisions for an object. More info See in Glossary generated for the Tile. The Collider shape is based on a cell of the Tilemap.
The shape of a cell depends on the Cell Layout selected for the Tilemap.If you do not have this option, then the 2D Tilemap Editor package may not be installed.
The Tile Palette window is empty by default. Select the New Palette drop-down menu to open a list of Tile Palettes available in the Project, or for the option to create a new Palette. Select the Create New Palette option to create a new Palette.
After selecting the option to create anew Palette, the Create New Palette dialog box becomes available. It contains the different property settings and options available when creating a new Palette:. Give the newly create Palette a name and select the desired settings, then select the Create button. Select the folder to save the Palette Asset file into when prompted. The newly created Palette is automatically loaded in the Tile Palette window.
Drag and drop Textures or Sprites A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info See in Glossary from the Assets Any media or data that can be used in your game or Project. An Asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image.
New Tile Assets are generated in the selected save location, and the Tiles are placed on the grid of the active Tile Palette window. Use the following shortcuts and actions to navigate the Palette window and began picking Tiles to paint on the Tilemap in the Editor window. The Active Brush inspector A Unity window that displays information about the currently selected GameObject, Asset or Project Settings, alowing you to inspect and edit the values. More info See in Glossary is at the bottom of the Tile Palette window.
You can use it to change the current active Brush and its properties. This is minimized by default. To expand it, drag the bottom toolbar A row of buttons and basic controls at the top of the Unity Editor that allows you to interact with the Editor in various ways e.
More info See in Glossary upwards. The tools for picking and painting with Tiles can also be used to edit the Tile Palette directly, allowing you to move and manipulate the Tiles currently placed on the Tile Palette. Refer to the documentation on Painting on Tilemaps for the shortcuts and functions of the Palette tools which are available for editing the Palette as well.
You can convert an existing Prefab An asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene.
To do this, the Prefab must not already be a Palette Asset, and it must have a Grid component on its topmost GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more.
More info See in Glossary. To convert a Prefab, drag and drop it onto the Tile Palette toolbar highlighted in the image above.
The new Palette Asset has the same name as its source, and you can select it from the Palette drop-down menu.
Built-in scene tools such as the move tool are Gizmos, and you can create custom Gizmos using textures or scripting. Some Gizmos are only drawn when the GameObject is selected, while other Gizmos are drawn by the Editor regardless of which GameObjects are selected.There are two ways to create a Tile A simple class that allows a sprite to be rendered on a Tilemap.
More info See in Glossary Asset in Unity; the first method is to directly create a Tile Asset from the Assets Any media or data that can be used in your game or Project.
An Asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image. More info See in Glossary menu. The second method is to automatically generate Tile Assets from a selection of Sprites. You will be prompted to name and save the new Tile Asset to your chosen location. Refer to the documentation on Tile Assets for more information.
Tiles can be automatically generated when selecting Sprites for a Palette in the Tile Palette window. Refer to the documentation on Tile Palettes for more information about the different options available when creating or editing Palettes. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development.
You will be prompted for the save location for the new Tile Assets. Select the save location, and the new Tile Assets are generated in the selected folder, and the Tiles are placed in the Palette. Version: Language : English. Unity Manual. Unity User Manual Tile Assets. Creating Tilemaps. Publication Date: Discussion in ' 2D ' started by BaozitouMar 26, Search Unity. Log in Create a Unity ID. Unity Forum. Forums Quick Links. Asset Store Spring Sale starts soon! Unite Now has started!
2D Hex Sprites - Hexagonal Tile Setup
Come level up your Unity skills and knowledge. How do I make hexagon grid? Like civilization? Joined: Aug 6, Posts: Im a total beginner, I'm very interesting in 2D Turn-based strategy games. Im trying to learn unity3d and I have no background of programming. I know Unity3d equipped with grid but its a rectangle shape.
I wanna make it into hexagon grid so that each cell is surround by 6 others cells.
Creating a Tile Palette
I won't mind the shape, as long as accomplished every one cell surround by 6 others cells instead of every one cell surround by four cells.
BaozitouMar 26, Joined: Jan 14, Posts: 8, As a complete beginner to both Unity and programming, this will be rather difficult. You should probably stick to square grids and other easier projects for a year or two, level up your programming skills, and then come back to this.
The basic idea is, every other row is offset by one-half the cell width. So you just have to take that into account when figuring out where to draw each cell, and again in reverse when figuring out what cell is hit by any location on the map plane. You'll also need to figure out what the neighboring cells are for any cell; this too varies for every other row. It's not rocket science, but there are plenty of opportunities there to trip you up and cause hair loss in a beginner.
So, as for all beginners, the best advice is to put your dream game on the back burner for a few months or years, and build your skills. Do the tutorials actually do them, not just watch themwrite code every day, practice doing algebra in the margins of your notepad when nobody is looking, etc. Then come back to your dream game, and you'll be ready to do it. In the end this will be faster than stubbornly trying to sink your teeth into a project you're not ready for.
JoeStroutMar 26, BusyCat and Baozitou like this. I confess I've never used the Tilemap feature of Unity — it's fairly new, and the last time I was working on a map-based game, that feature didn't exist yet. So I just drew my tiles as a bunch of Sprites, or else with some fancy custom mesh work. But yeah, from what I've heard, nowadays you'd probably use Tilemap. The thing to do is to go to the Learn link at the top of this page, set aside at least a few hours a week, and start working your way through it.
Don't worry about whether the tutorials you're doing seem related to what you eventually want to make. It's all related. It's all good stuff you will need to know later. So get comfy, grab a coffee, and start building stuff, with those tutorials as your guide.