Easy Tilemaps and Dynamic Auto Tiling - Unity 2D

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2024
  • In this video we'll create a tilemap, add a collider (so we can use it as platforms or walls) and also look at creating dynamic tilemaps using Auto Tiling and Tile Rules!
    By implementing tile rules, you can paint on your scene and it'll automatically place the correct sprites depending on the other sprites around it - it's really cool!
    On my Patreon you can get the package which includes this Tilemap and Rule Tile - so you don't have to set it up yourself:
    / gamecodelibrary
    (My Patreon also includes all past and future code, packages and assets used on my channel!)
    www.buymeacoffee.com/gamecode...
    Spritesheet: rottingpixels.itch.io/nature-...
    Easy 2D Platformer: • Platformer Player Move...
    0:00 - Intro
    0:14 - Package Setup
    0:30 - Sprite Setup
    1:02 - Tile Palette Setup
    1:33 - Grid Tilemap + Tilemap Working!
    1:58 - Auto Tiling!
    2:07 - Rule Tile Setup
    2:37 - Rule Tile Explanation
    3:30 - Rule Tile into Palette + Working!
    3:44 - Tilemap Colliders
    4:27 - Layered Tilemaps
    5:27 - Outro

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

  • @GameCodeLibrary
    @GameCodeLibrary  11 หลายเดือนก่อน +4

    In response to: "Why is the pixel per unit set to 15 instead of 16❓"
    You can try it out with 16x16 - but with exact sizing with sprites this can cause tearing: you’ll see white lines flickering between your tiles!
    To fix this I use the easy way of setting the pixel per unit to be one less, which means we have a bleed edge - an overflow for the sprites!
    There are two other ways I know to fix this:
    1. Manually edit your sprites to be bigger with a bleed overlay: so add a few extra padded pixels around all edges so it’s say 18x18, then you can use 16x16 in Unity safely! (Time consuming!)
    2. Use a sprite atlas (found in the 2D menu) where you add an entry for each sprite in your tile map.
    Since this is a quick and easy version, I did my lazy way which I use for small projects! In professional level production you can use one of the above methods.

    • @timothykessler5029
      @timothykessler5029 6 หลายเดือนก่อน +2

      not sure if the tearing is the same issue, but i just saw another video on tilemaps by MoreBBlakeyyy where he shows that turning off anti-aliasing in the project settings fixes this.

    • @blazeDev_vlog
      @blazeDev_vlog 5 หลายเดือนก่อน +1

      You can fix this issue by just creating a sprite atlas of all sprites used with tiles. Hope it helps :)

  • @0Turtlez
    @0Turtlez ปีที่แล้ว +4

    Thank you so much! I’ve been looking all day for a tutorial for exactly what you showed.

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

      You’re welcome! I’m glad I could help 😊

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

    useful tutorial thankyou! keep good work

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

    A couple days ago when I was looking in to this I would have loved this tutorial. Explain things so well.
    Thank you.

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

      Thank you I’m glad you think so!
      Hopefully next time I can make a video you need when you need it! 😝🫶

  • @nTu4Ka
    @nTu4Ka 9 หลายเดือนก่อน +6

    You deserve a lot more subscribers.
    Really good quality tutorial!

    • @GameCodeLibrary
      @GameCodeLibrary  9 หลายเดือนก่อน

      Thank you I really appreciate that 🤝 I’ll keep working hard to put out helpful vids! 🙏

  • @SaintMemes701
    @SaintMemes701 11 หลายเดือนก่อน +2

    You make the best and the quickest tutorials and it helps a lot thankyou very much

    • @GameCodeLibrary
      @GameCodeLibrary  11 หลายเดือนก่อน +1

      You're welcome! I glad you like them!
      I used to always get impatient with slow TH-cam tutorials, so I plan to make the best and most concise videos I can! 🤩

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

    Awesome tutorial, thank you

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

      You’re welcome!! I’m glad you liked it

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

    A fantastic Tutorial, nice and clear and easy to follow 👍

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

      Thank you so much! I really appreciate it 🥲 I worry if they’re either too fast or too slow, going to try find the perfect speed! Your comment helps my confident 🙏

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

      @@GameCodeLibrary Well I was able to follow, and I'm super new to Unity, I think you nailed the speed, what I really like is the bubbles you have pop up showing exactly what you are doing in the Inspector/project/Heiarchy and Such, It really does make it easier to understand 😃

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

      @@RadicalTrailers Yeah I had the idea for the text bubbles later on and I'm glad I added them!! Whenever I followed tutorials I'd forget what they'd said, so it's nice to have an on screen reference ☺
      I have lots of video ideas so hope some future ones help you too! Thanks again for your opinions, helps so much!
      🤠

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

    Awesome!

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

    Just found your channel,its just like watching a video from brackeys, just as clear and entertaining, love it

    • @GameCodeLibrary
      @GameCodeLibrary  11 หลายเดือนก่อน +1

      Thanks so much! Getting the brackeys comparison is high praise haha - I'll try keep up the vids!

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

      @@GameCodeLibrary looking forward to learning more from you 😁

  • @itsbarrex
    @itsbarrex 6 หลายเดือนก่อน

    wow! easier than I thought! thank you for this tutorial, love it! keep it up =D

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

    your voice is very soothing

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

    I love your voice

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

      Thank you!! I try to sound the least annoying as possible 😂

  • @Mimi_py
    @Mimi_py 2 หลายเดือนก่อน

    Good for a refresher on how to do it, People new to unity might struggle to follow along, Helped me so I like though

    • @GameCodeLibrary
      @GameCodeLibrary  2 หลายเดือนก่อน

      Difficult to find the right balance sometimes - but I'm glad you enjoyed! Hopefully if it's too fast for new people, they can rewatch or pause it lots :p

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

    Great stuff. Please do more.

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

      I have lots and lots planned! Let me know if there is anything in particular that you'd like to see. :-)

  • @kozmobotgames
    @kozmobotgames 5 หลายเดือนก่อน

    Amazing tutorial!

    • @GameCodeLibrary
      @GameCodeLibrary  5 หลายเดือนก่อน +1

      Thank you!

    • @kozmobotgames
      @kozmobotgames 5 หลายเดือนก่อน

      @@GameCodeLibrary ever since I was a child, I was always dreaming about making games. Although I opened my first YT channel for traditional drawing when I was 19 years old, I started a game development channel one year later. I am proud to see how is my channel growing after two years of actively posting new videos every week or two weeks. I am happy to have so many views and positive reviews from people who watch my tutorials!

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

    How would you make a platform made from tileMap falling for example ? I have a script working for gameobjects I created ( Like a rectangle platform ) , but I can't attach those to tile maps ?

  • @johnathansuda570
    @johnathansuda570 6 หลายเดือนก่อน

    Any experience with incorporating navmesh with tile mapping?

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

    On my Patreon you can get the package which includes this Tilemap and Rule Tile - so you don't have to set it up yourself:
    www.patreon.com/posts/tilemap...
    (My Patreon also includes all past and future code, packages and assets used on my channel!)

  • @edithasd2806
    @edithasd2806 8 หลายเดือนก่อน

    lol I solved it. Thanks a lot

    • @GameCodeLibrary
      @GameCodeLibrary  8 หลายเดือนก่อน +1

      I didn’t see the original problem but I’m glad you solved it 😝🙏

  • @battelbad12
    @battelbad12 8 หลายเดือนก่อน

    The moment I saw aseprite I immediately sub 😂

    • @GameCodeLibrary
      @GameCodeLibrary  8 หลายเดือนก่อน

      Lol aseprite superiority 👌

    • @battelbad12
      @battelbad12 8 หลายเดือนก่อน

      @@GameCodeLibrary wise word 🙏

  • @mysticowlgames
    @mysticowlgames 9 หลายเดือนก่อน

    How would you work with sliding colliders or slopes in Rule Tiles? I am unable to figure it out

    • @GameCodeLibrary
      @GameCodeLibrary  9 หลายเดือนก่อน

      Hey! I haven't tried it out myself, but I've seen this cool video for handling slopes and rule tiles!
      th-cam.com/video/dd1Fe3AiWdw/w-d-xo.html
      However, it's a paid for tool.
      I haven't seen anyone else work with rule tiles and slopes! So you could manually add the slope on after painting your map out with rule tiles simple block shapes! Sorry I couldn't help more, good luck :-)

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

    The used by composite part does not appear for me... what is the reason?

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

      Sorry for such a late reply! Was away this week :p
      On your actual tilemap component, make sure you add a Tilemap Collider 2D and then a Composite Collider 2D.
      After the Composite Collider 2D is added, the tick box should appear on your Tilemap Collider 2D.
      When ticked, it should merge your multiple tile colliders into one big collider! If it doesn't appear to - try resetting your project and seeing if your collider has updated.
      Hope this helps!

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

    can you make a tutorial on using LDtk or Tiled. I think that will improve workflow than using the unity tile map edit.

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

      I could do a video on the options for tilemaps other than unitys basic one! And show how to import with them all… I’m covering the basics of getting a project up and running in the easiest way right now, but I’ll get into details like this in the future!!
      Thanks for the suggestion 😊

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

      @@GameCodeLibrary thanks for keeping an open mind. I've been digging to find more tutorials on Tiled Edit and LDtk. cuz i saw a TH-camr use Tiled and automated the workflow of adding collision and new tiles so effciently that makes the Unity Tilemap look so obsolete.

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

    Why is the pixel per unit set to 15 instead of 16?

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

      You can try it out with 16x16 - but with exact sizing with sprites this can cause tearing: you’ll see white lines flickering between your tiles!
      To fix this I use the easy way of setting the pixel per unit to be one less, which means we have a bleed edge - an overflow for the sprites!
      There are two other ways I know to fix this:
      1. Manually edit your sprites to be bigger with a bleed overlay: so add a few extra padded pixels around all edges so it’s say 18x18, then you can use 16x16 in Unity safely! (Time consuming!)
      2. Use a sprite atlas (found in the 2D menu) where you add an entry for each sprite in your tile map.
      Since this is a quick and easy version, I did my lazy way which I use for small projects! In professional level production you can use one of the above methods.
      Hope that helps!! Long reply 😇

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

      @@GameCodeLibrary Thanks. I tried setting my player sprite to one pixel smaller and it no longer looks like it's floating 👍

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

      I’m glad! It’s always good to try out things to see how it works for your game 😊

    • @Novastar.SaberCombat
      @Novastar.SaberCombat ปีที่แล้ว

      It's always a good idea to give a little "wiggle room" to everything. Otherwise, collisions, layering, and even mechanics can look... well... too rigid and mechanical.
      In the original "Pac Man" game (1980's), controlling mr Pac guy allowed for "rounded" cornering during player manipulation. The ghost enemies were NOT permitted to do this. 🙂 This is why it was easier for players to gain ground and escape ghosts in "J-bends" or multiple curves as opposed to straightaways.
      What does this have to do with 15 pixels vs. 16? Well, the CORNERS of ledges can be rounded as well. This allows players to leap up to ledges (or fall from them) with less rigidity and blockiness. 🙂
      🐲✨🐲✨🐲✨

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

      @@Novastar.SaberCombat A great explanation!! 🤩

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

    I am using slopes in the tile map and the collider is not pixel perfect . And the character looks like it's floating

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

      You can try using a polygon collider 2D and shaping that to your slope instead of the tilemap collider!
      I’ll try it out tomorrow to see if I can find something better if that doesn’t work for you 🙏

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

      @@GameCodeLibrary thanks! you're too good i'll check it out

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

      well i did some experiment, if i redraw the slopes in a new sprite sheet like 64x64 tiles (original is 16) i can see the tile collider is much more accurate... so weird unity over pass that

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

    ❗❗❗😱📢 50% OFF LAUNCH SALE!! 😱👾❗❗❗
    BUY THE COMPLETE GAME TEMPLATE NOW!!!
    gamecodelibrary.itch.io/2d-platformer-template

  • @FP-ih1lu
    @FP-ih1lu 2 หลายเดือนก่อน

    super hard to follow along, I ran into 10 problems that you didn't run into, and nothing is actually explained for the viewer's understanding :(

    • @GameCodeLibrary
      @GameCodeLibrary  2 หลายเดือนก่อน

      That’s a shame I’m sorry! What went wrong? Hopefully you can find a slower video that works for you 🙏