< Return to Video

How to use Isometric Tilemap in Unity 2018.3! (Tutorial)

  • 0:00 - 0:05
    2D Tilemap is a powerful tool that provides you with a simple way to create
  • 0:05 - 0:08
    2-dimentional environments, based on the grid layout.
  • 0:09 - 0:13
    In 2018.3, Unity is adding support
  • 0:13 - 0:14
    for a new type of grid
  • 0:14 - 0:17
    which will allow you to make isometric levels
  • 0:17 - 0:19
    the like of which can be seen in:
  • 0:19 - 0:21
    Pillars of Eternity
  • 0:21 - 0:22
    The Banner Saga
  • 0:23 - 0:25
    Shadowrun, and many more.
  • 0:26 - 0:29
    In addition, since 2018.2,
  • 0:30 - 0:32
    Unity also support hexagonal grids
  • 0:32 - 0:35
    which are commonly encountered in strategies,
  • 0:35 - 0:36
    and other turn-based games.
  • 0:38 - 0:40
    In this video, you will learn how to setup
  • 0:40 - 0:43
    the new isometric and hexagonal tilemaps,
  • 0:43 - 0:45
    as well as all the essential workflows
  • 0:45 - 0:47
    that will help you get started.
  • 0:48 - 0:51
    Be sure to check out the demo project
    in the video description,
  • 0:51 - 0:55
    if you'd like to use the demonstrated assets yourself
  • 0:55 - 1:00
    Tilemap has been a part of the editor since 2017.2
  • 1:00 - 1:04
    and doesn't require any additional package downloads to work.
  • 1:04 - 1:06
    To use the new tilemap grids,
  • 1:06 - 1:07
    you just need to make sure
  • 1:07 - 1:10
    that you are on the right version of Unity.
  • 1:10 - 1:15
    You are going to need 2018.2 or higher for hex tilemaps.
  • 1:15 - 1:19
    And 2018.3 onwards for isometric。
  • 1:20 - 1:24
    Tilemap consists of several components working together.
  • 1:25 - 1:27
    First we have a grid GameObject.
  • 1:28 - 1:31
    This create your chosen grid type in the scene
  • 1:31 - 1:34
    and gives you further options to customize its parameters,
  • 1:34 - 1:35
    such as the cell size.
  • 1:38 - 1:42
    We can then attach one or more tilemap game objects to our grid.
  • 1:43 - 1:45
    Once we have a tilemap,
  • 1:45 - 1:48
    we need to create a palette which will hold our tile assets.
  • 1:49 - 1:51
    You can access the tile palette menu
  • 1:51 - 1:54
    from Window -> 2D -> Tile Palette
  • 1:55 - 1:57
    From here, you can create new palettes
  • 1:57 - 2:00
    corresponding to each of the different grid types.
  • 2:00 - 2:02
    You can add tiles to a palette
  • 2:02 - 2:06
    by simply dragging the sprites from the Project Window onto the palette.
  • 2:07 - 2:08
    Once you have a tile ready,
  • 2:08 - 2:10
    select it with the brush tool,
  • 2:10 - 2:13
    and choose the tile map game object you wish to paint on.
  • 2:14 - 2:16
    If you go back to the scene view,
  • 2:16 - 2:19
    you will now be able to start painting with your tile.
  • 2:21 - 2:26
    Your isometric or hexagonal grid can hold more than one tilemap.
  • 2:27 - 2:31
    You can use this to place some decorative objects on top of your tiles.
  • 2:32 - 2:35
    Or to create elevation levels and buildings.
  • 2:36 - 2:39
    You can change the sort order of the new tilemap,
  • 2:39 - 2:41
    so that it renders on top of the previous one.
  • 2:41 - 2:44
    You can also change the tile anchor setting,
  • 2:44 - 2:47
    to place your tiles on the higher point relative to the grid.
  • 2:48 - 2:53
    If you're using isometric tiles, you could also use a Z as Y tilemap,
  • 2:53 - 2:58
    and create elevation by simply changing the Z position of the tiles.
  • 2:58 - 3:03
    There's an example available on the 2d tech demos repository,
  • 3:03 - 3:04
    where you will find a scripted brush
  • 3:04 - 3:08
    that lets you adjust the set value dynamically as you paint.
  • 3:08 - 3:12
    You can find a link to the repository down in the video description.
  • 3:13 - 3:18
    At some point you will likely want to add collision to your tiles.
  • 3:18 - 3:22
    For this purpose you can use a Tilemap Collider 2D component,
  • 3:23 - 3:27
    which will automatically generate collision shapes for each individual tile.
  • 3:28 - 3:30
    In the tile asset settings,
  • 3:30 - 3:34
    you can adjust the type of physics shape each tile has.
  • 3:34 - 3:39
    You can change the collider to be either sprite based or grid based.
  • 3:39 - 3:41
    If your tile has a grid Collider,
  • 3:41 - 3:45
    its collision shape will match exactly with the shape of the grid cell
  • 3:45 - 3:46
    it is attached to
  • 3:47 - 3:51
    With a Sprite Collider you can add a custom physics shape to your tiles
  • 3:51 - 3:53
    by using the sprite editor.
  • 3:53 - 3:55
    Once you have a tilemap collider,
  • 3:55 - 3:58
    you might wish to merge the individual shapes into one
  • 3:58 - 4:01
    by using a Composite Collider 2D
  • 4:02 - 4:08
    As you can see tilemap offers a simple and fast
    solution to creating physics shapes.
  • 4:09 - 4:11
    If you have characters in your top-down
    game,
  • 4:11 - 4:13
    you will most likely want them to be able to
  • 4:13 - 4:16
    go behind and in front of objects on your level.
  • 4:17 - 4:18
    In this case
  • 4:18 - 4:21
    be sure to set the sort mode on the tilemap with your objects
  • 4:21 - 4:23
    to "Individual".
  • 4:24 - 4:28
    Now if your character sort order is the same as that of the tile map
  • 4:28 - 4:32
    it will appear to go behind and in front of the tiles on that tile map
  • 4:32 - 4:35
    You could adjust the sort order dynamically
  • 4:35 - 4:39
    to move the character to higher or lower elevation levels
  • 4:39 - 4:43
    If you want to speed up your world building with tilemap,
  • 4:43 - 4:46
    you can use Rule Tiles to extend your tile presets.
  • 4:47 - 4:51
    For example, you could make it so that when you're painting a certain type of terrain,
  • 4:51 - 4:55
    the correctly oriented tiles are chosen automatically for you.
  • 4:55 - 4:59
    You could also randomize different variations of the same tile.
  • 5:00 - 5:05
    Rule Tiles can save you a great amount of time in creating complex 2d environments.
  • 5:06 - 5:10
    The new hexagonal and isometric Rule Tiles are now available
  • 5:10 - 5:12
    on the 2d tech demos repository.
  • 5:12 - 5:16
    So feel free to go ahead and check them out for yourself.
  • 5:17 - 5:22
    Of course you're also able to extend tilemap with your own tile types.
  • 5:22 - 5:25
    Take a look at the featured documentation to learn more
  • 5:26 - 5:30
    Hopefully, this video has taught you some useful workflows for the new types of tilemap.
  • 5:31 - 5:33
    There's a lot more you can do,
  • 5:33 - 5:35
    but these basics will be a good starting point
  • 5:35 - 5:37
    if you want to try them out yourself.
  • 5:37 - 5:41
    You may also want to check out some of our tilemap blog posts,
  • 5:41 - 5:45
    including the one on procedural generation by Ethan Bruins.
  • 5:46 - 5:49
    The assets used in this video are available down in the link below
  • 5:49 - 5:52
    and are free for you to use as you wish.
  • 5:53 - 5:56
    As always, we're looking forward to seeing all the awesome projects
  • 5:56 - 5:59
    that you will create using unity's new tools.
  • 5:59 - 6:03
    Please share your creations and feedback on the unity forum
Title:
How to use Isometric Tilemap in Unity 2018.3! (Tutorial)
Description:

more » « less
Video Language:
English
Duration:
06:14

English subtitles

Revisions