Easy Tilemaps and Dynamic Auto Tiling - Unity 2D
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
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
6 ай бұрын
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
5 ай бұрын
You can fix this issue by just creating a sprite atlas of all sprites used with tiles. Hope it helps :)
Thank you so much! I’ve been looking all day for a tutorial for exactly what you showed.
@GameCodeLibrary
Жыл бұрын
You’re welcome! I’m glad I could help 😊
A couple days ago when I was looking in to this I would have loved this tutorial. Explain things so well. Thank you.
@GameCodeLibrary
Жыл бұрын
Thank you I’m glad you think so! Hopefully next time I can make a video you need when you need it! 😝🫶
You deserve a lot more subscribers. Really good quality tutorial!
@GameCodeLibrary
9 ай бұрын
Thank you I really appreciate that 🤝 I’ll keep working hard to put out helpful vids! 🙏
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!)
You make the best and the quickest tutorials and it helps a lot thankyou very much
@GameCodeLibrary
11 ай бұрын
You're welcome! I glad you like them! I used to always get impatient with slow KZread tutorials, so I plan to make the best and most concise videos I can! 🤩
Awesome!
Just found your channel,its just like watching a video from brackeys, just as clear and entertaining, love it
@GameCodeLibrary
11 ай бұрын
Thanks so much! Getting the brackeys comparison is high praise haha - I'll try keep up the vids!
@abyssianknight736
11 ай бұрын
@@GameCodeLibrary looking forward to learning more from you 😁
Awesome tutorial, thank you
@GameCodeLibrary
Жыл бұрын
You’re welcome!! I’m glad you liked it
A fantastic Tutorial, nice and clear and easy to follow 👍
@GameCodeLibrary
Жыл бұрын
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
Жыл бұрын
@@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
Жыл бұрын
@@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! 🤠
your voice is very soothing
wow! easier than I thought! thank you for this tutorial, love it! keep it up =D
@GameCodeLibrary
5 ай бұрын
Glad you enjoyed! :-)
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
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
Amazing tutorial!
@GameCodeLibrary
5 ай бұрын
Thank you!
@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!
Great stuff. Please do more.
@GameCodeLibrary
6 ай бұрын
I have lots and lots planned! Let me know if there is anything in particular that you'd like to see. :-)
I love your voice
@GameCodeLibrary
Жыл бұрын
Thank you!! I try to sound the least annoying as possible 😂
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 ?
Any experience with incorporating navmesh with tile mapping?
useful tutorial thankyou! keep good work
How would you work with sliding colliders or slopes in Rule Tiles? I am unable to figure it out
@GameCodeLibrary
9 ай бұрын
Hey! I haven't tried it out myself, but I've seen this cool video for handling slopes and rule tiles! kzread.info/dash/bejne/lphlqMdsccy9lNo.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 :-)
lol I solved it. Thanks a lot
@GameCodeLibrary
8 ай бұрын
I didn’t see the original problem but I’m glad you solved it 😝🙏
can you make a tutorial on using LDtk or Tiled. I think that will improve workflow than using the unity tile map edit.
@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
Жыл бұрын
@@GameCodeLibrary thanks for keeping an open mind. I've been digging to find more tutorials on Tiled Edit and LDtk. cuz i saw a KZreadr use Tiled and automated the workflow of adding collision and new tiles so effciently that makes the Unity Tilemap look so obsolete.
The used by composite part does not appear for me... what is the reason?
@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!
❗❗❗😱📢 50% OFF LAUNCH SALE!! 😱👾❗❗❗ BUY THE COMPLETE GAME TEMPLATE NOW!!! gamecodelibrary.itch.io/2d-platformer-template
Why is the pixel per unit set to 15 instead of 16?
@GameCodeLibrary
Жыл бұрын
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
Жыл бұрын
@@GameCodeLibrary Thanks. I tried setting my player sprite to one pixel smaller and it no longer looks like it's floating 👍
@GameCodeLibrary
Жыл бұрын
I’m glad! It’s always good to try out things to see how it works for your game 😊
@Novastar.SaberCombat
11 ай бұрын
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
11 ай бұрын
@@Novastar.SaberCombat A great explanation!! 🤩
The moment I saw aseprite I immediately sub 😂
@GameCodeLibrary
8 ай бұрын
Lol aseprite superiority 👌
@battelbad12
8 ай бұрын
@@GameCodeLibrary wise word 🙏
I am using slopes in the tile map and the collider is not pixel perfect . And the character looks like it's floating
@GameCodeLibrary
Жыл бұрын
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
Жыл бұрын
@@GameCodeLibrary thanks! you're too good i'll check it out
@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
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
2 ай бұрын
That’s a shame I’m sorry! What went wrong? Hopefully you can find a slower video that works for you 🙏