Unity Tilemaps - Hex, rectangle, isometric + rule tiles

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 มิ.ย. 2024
  • Unity Tilemaps are incredibly powerful and easy to use. Learn how to get up and running quickly with hexagon, rectangle, or isometric palettes as well as the power of using rule-based tilesets. I'll also show you how to fix things like incorrect sorting order of tiles.
    0:00 Intro
    0:13 Setup
    1:44 Creating a palette
    4:04 Tile color and collider
    5:25 Hexagon tileset
    6:39 Adding depth tiles for a 3d look
    8:27 Fixing sorting order of tiles
    9:35 Rule-based tilesets
    13:48 Custom base class for more flexibility
    18:37 Summary
    =========
    ❤️ Become a Tarobro on Patreon: / tarodev
    =========
    🔔 SUBSCRIBE: bit.ly/3eqG1Z6
    🗨️ DISCORD: / discord
    ✅ MORE TUTORIALS: / tarodev

ความคิดเห็น • 41

  • @meowsqueak
    @meowsqueak 2 ปีที่แล้ว +21

    Great tutorial!
    Just to clarify, that little circular arrow in the centre of the Rule Tile rule grid is actually “rotate” not “flip”. So it will apply the rule to each 90 degree *rotation* of the tile. This isn’t quite the same as flipping (the double-arrow symbols) as they act like mirrors and reverse left/right, which will produce a different result.
    You can also use [ and ] to rotate the current brush tile manually, and hold shift with [ and ] to flip. In my default Unity install the latter conflicts with another binding so I had to go into Unity preferences to sort that out.

    • @Tarodev
      @Tarodev  2 ปีที่แล้ว +1

      Great info, thank you! Pinned

  • @ericblakenburg5380
    @ericblakenburg5380 ปีที่แล้ว +3

    This was thé tutorial I was looking for. Thank you so much ❤️❤️❤️

  • @SteveTrabold
    @SteveTrabold 9 หลายเดือนก่อน +1

    Thank you for these! Your tutorial style is fantastic...clear good information!

  • @deaddoctor
    @deaddoctor 3 ปีที่แล้ว +3

    Awesome tutorial!

    • @Tarodev
      @Tarodev  3 ปีที่แล้ว

      Glad it helped you :)

  • @benjaminborja5029
    @benjaminborja5029 3 ปีที่แล้ว +3

    Hey man, i like your style explaining stuff, did you know if there is an asset that can combine multiple single tile colliders into one single big collider? I have phisycs issues when I'm using tiles beacuse of that...thank you!

  • @misal-isahabe5281
    @misal-isahabe5281 ปีที่แล้ว

    Thanks for this contant!

  • @PeterMilko
    @PeterMilko 2 ปีที่แล้ว

    Can you show how to make a diagonal path for a grid tile map?

  • @venturar
    @venturar 2 ปีที่แล้ว +6

    Hey man nice Chanel, it would be nice a video about 2D optmization,its something that would help a lot of mobile devs like me

    • @Tarodev
      @Tarodev  2 ปีที่แล้ว +3

      That's a good idea. I'll add it to the list 😊

  • @SaltyDylpickle
    @SaltyDylpickle 2 ปีที่แล้ว +1

    Heya, thanks for this tutorial!
    I am wondering how I can make the gridlines show in my game view? It seems to be default in yours, but mine only show in the scene view...

  • @PK-se2jh
    @PK-se2jh 2 ปีที่แล้ว

    thankyou soo much :)

  • @cryser5
    @cryser5 7 หลายเดือนก่อน +1

    How the fuck did I miss this godlike thing, that u can drop instantly in playmode with this option enabled u have casually shown... dude this assembly time was driving me crazy...

    • @Tarodev
      @Tarodev  7 หลายเดือนก่อน

      ;)

  • @DemonRax47
    @DemonRax47 4 หลายเดือนก่อน

    Hey there! Thanks for the great video, helped me to get the tilemaps stuff going!
    I got a question though, would appreciate any help. In your example, you add the override for the RuleTile. I'm not using them yet but I thought it would be great to add more attributes to a normal tile, such as a bool, for example. I went for the same code you did, adding the override etc - but for the Tile, instead of the RuleTile. And it does not work. I think what I'm missing and I couldn't figure it out from your video - is how do I make the script work? How should I connect it to the Tile so the method is overridden? Script cannot be added to the game object as a component, because it's not a MonoBehaviour, and if I just leave it there - it seems like the running application is simply ignoring it.
    Thanks!

  • @drunk3np1nky40
    @drunk3np1nky40 ปีที่แล้ว +1

    Great video! I wonder if it's possible to highlight tiles on tilemap. Has anyone ever implemented anything like this?

    • @Tarodev
      @Tarodev  ปีที่แล้ว

      Your interaction options are far greater when generating the tile map via code (not using unity tile map). But for tile map you can use a custom tile class and in your mouse logic script, detect the current hovered tile and raise the color value a bit.

  • @fokeyjo
    @fokeyjo ปีที่แล้ว +1

    15:50 you allude to something I'm struggling with, how you implement things like that walkable flag - Are you working with a rigidbody or using your own collision routines and stopping the player? I'm trying to develop a game with enemies walking in one area and the player walking in another, so their collision maps are the exact opposite, and colliders seem to be universal across all objects with rigidbodies.

    • @fokeyjo
      @fokeyjo ปีที่แล้ว

      Think I realise now what this about - for when you are doing calls to Tilemap.GetTile(), this is so you can get useful information from the tile without attaching a gameobject and having to do GetComponent calls to it. Trying this out, though, I've found the line to set up the menu (in 2021.3) should be more like this now: [CreateAssetMenuAttribute(menuName = "2D/Tiles/YourCustomGameRuleTile")] otherwise it will either do nothing and fail silently, or start warning about a class name mismatch.

  • @user-tp1cj5fc2y
    @user-tp1cj5fc2y 2 ปีที่แล้ว +7

    Great tutorials.
    It would be even more magnificent if you attach assets, so we can follow along

  • @tobiasfilms8825
    @tobiasfilms8825 3 ปีที่แล้ว +1

    Very helpful tutorial! Is there a way to add rule-based tiling with hexagons?

    • @Tarodev
      @Tarodev  3 ปีที่แล้ว +1

      Yup absolutely! Word of warning though: the required tile combinations go up drastically whilst using hexagons. Be prepared for a bigger art budget/time investment!

  • @midniteoilsoftware
    @midniteoilsoftware 2 ปีที่แล้ว +1

    Where did the GameRuleTile script come from? It just seemed to magically appear when you created the rule tile. No such script was created when I created my rule tile. I manually create a GameRuleTile script but it will not allow me to add it to my rule tile. I'm using Unity 2020.3.19f1.

    • @Krobelux
      @Krobelux ปีที่แล้ว

      It might be a newer version feature. I was working with the 2019 version and it didn't have this feature for me. I recently updated to 2022 version and it autocompletes for me.

    • @alwaid8149
      @alwaid8149 3 หลายเดือนก่อน

      Late reply but maybe someone else will need it: make sure you are using "using UnityEngine.Tilemaps" also the script base class should be TileBase, not MonoBehaviour

  • @Hinkel84
    @Hinkel84 2 ปีที่แล้ว +1

    Do you have the template for such a hex file? I don't know how to start in photoshop, for the tile :(

    • @Tarodev
      @Tarodev  2 ปีที่แล้ว +3

      What I do is create a hexagon in Unity, then open it in photoshop. So do what I do at 2:30, but for hex :)

    • @Hinkel84
      @Hinkel84 2 ปีที่แล้ว

      @@Tarodev Hello, thx. But I have no idea, where you open it in photoshop?

    • @Tarodev
      @Tarodev  2 ปีที่แล้ว +2

      @@Hinkel84 One sec mate I'll get you one

    • @Tarodev
      @Tarodev  2 ปีที่แล้ว +5

      @@Hinkel84 Flat top: i.imgur.com/j7BmCjm.png
      Pointy top: i.imgur.com/PwOYWnX.png

    • @Hinkel84
      @Hinkel84 2 ปีที่แล้ว +2

      @@Tarodev Thank you very much for the awesome help :)

  • @mostlyokay
    @mostlyokay ปีที่แล้ว

    So from other comments I gather this isn't useful if I want to implement A*? I'd have to create the map completely in code? Is there a hybrid approach which would let me "paint" the tilemap but have a representation of it in code?

    • @Tarodev
      @Tarodev  ปีที่แล้ว +1

      You can absolutely implement a* on this as you can grab the tile positions just the same as a code map. Deciding between a tile map vs code is an important decision... Tile map is easy, but code gives you way more power.

    • @kyllzoldyck
      @kyllzoldyck 11 หลายเดือนก่อน

      @@Tarodev do you have an example using tilemap and pathfinding? I was looking but I don’t find it, only maps generated by code

  • @ivans8713
    @ivans8713 10 หลายเดือนก่อน

    how is it showing grid for him after painting, and for me it doesnt

  • @noobcraft5712
    @noobcraft5712 3 ปีที่แล้ว +2

    Why are you not uploading

    • @Tarodev
      @Tarodev  3 ปีที่แล้ว +3

      That's so funny. You commented this just as I started uploading a new video. You sensed something was up :P

    • @noobcraft5712
      @noobcraft5712 3 ปีที่แล้ว

      @@Tarodevoh good

  • @derekspammerton5295
    @derekspammerton5295 6 หลายเดือนก่อน +1

    I'm getting so lost all over the place... none of my files match aaaa