Tilemap in Unity (Build Worlds Easily)
Вставка
- Опубліковано 13 чер 2024
- Let's learn how to use the Built-in Unity Tilemap!
🌍 Get the Complete Builder-Defender Course! ✅ unitycodemonkey.com/coursebui...
👍 Learn to make an awesome game step-by-step from start to finish.
Interested in a Complete Visual Scripting Course?
unitycodemonkey.com/intereste...
Custom Tilemap in Unity with Saving and Loading
• Custom Tilemap in Unit...
Powerful Generics Added! Grid System
• Powerful Generics Adde...
Grid System in Unity
• Grid System in Unity (...
Character Controller in Unity 2D
• Character Controller i...
🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!
✅ store.steampowered.com/app/12...
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🤖 Join the Community Discord / discord
📦 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
#unitytutorial #unity3d #unity2d
--------------------------------------------------------------------
Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Website: unitycodemonkey.com/
- Twitter: / unitycodemonkey
- Facebook: / unitycodemonkey
🌐 Have you found the videos Helpful and Valuable?
❤️ Get my Courses unitycodemonkey.com/courses or Support on Patreon www.patreon.com/unitycodemonkey
Btw you can flip the selected tile with "X" or "Y" and rotate it with "comma" or "period". No need for extra versions.
Well-made and informed. Only thing I'd do differently is turn off AA in a 2D tilemap game, since it's not necessary and might waste performance. Turning it off gets rid of the gaps between tiles with no extra steps. Also, I'd put obstacles and things like grass in a separate layer instead of generating colliders for all of them and erasing the grass colliders by hand. If you miss any and forget them it could create some unexpected collisions in your game.
i know Im randomly asking but does anybody know a way to get back into an instagram account??
I was dumb forgot my login password. I would love any help you can give me
@Johnny Matthias Instablaster :)
@Emory Zayn thanks for your reply. I got to the site thru google and I'm trying it out atm.
I see it takes quite some time so I will get back to you later with my results.
💬 Here's a really useful Unity tool to help you build levels super fast!
It's super versatile, lets you build Rectangular, Isometric and Hexagonal maps.
Interested in the Visual Scripting course? Click here! 🌐 unitycodemonkey.com/interestedvscourse.php
Thanks for the tip with the Sprite Atlas to fix the cell gap between tiles. I am currently working on my own game and this was a huge help, since I couldn't figure out how to get rid of them. Perfect timing :)
What a wonderous hour to wake up to a new coding lesson with Kode Monkee XD. It's like 2 in the morning here.
Great tutorial! Thank you very much for this in-depth look at tiling :)
Great to see another video! Thanks for all your content!
Awesome as always! Keep up the awesome work you do.
Some follow up videos I think would be great are: auto-tiling, programmatic tiles, and procedural generation. What I'd love to see though, is how to take the tilemap system from your previous videos and extend it to cover the main features of unity's tilemap. ie. editor workflow. Or maybe merging the two, so you can take advantage of unity's pre-built system but be able to easily add data or other features to each tile via the custom tilemap
Yup I would like to look into the Rule Tile, it does seem quite interesting!
@@CodeMonkeyUnity I know I'd certainly love to see more tutorials around tile-maps (Particularly Procedural Generation with Perlin Noise, Rule Tile, Programmatic, etc.)
@@CodeMonkeyUnity after two year i would be happy see a procedual generation for tile map and level design. plus how cloud change tiles in code ?
Exactly What i was looking for Thanks 🙏
I wouldn't have figured out how to remove the gaps between cells without you. Thank you
Thanks, I didn't know about the Atlas and that solved a problem I was stuck on for weeks
Same
Thank you so much! This helped me a ton
A really useful video. There are many nuances that I didn't use... I'm Waiting for your cool courses, I like your code and step-by-step guide)))
Now that about a year has passed it'd be cool to revisit this subject and look into some of the new 2d/tile map tools items like the rule tile. It's incredibly powerful but like many fresh unity tools incredibly limited and 'black-boxy'. I've been trying to cobble together a hybrid of Unity tilemap and the code based tilemap from your previous tutorials. It's coming along well enough, but I'd love to see what a more adept unity dev would come up with. Like other commenters I'd also love to see how both systems could be used with procedural generation as well as how to store data in cells with unity's tilemap and how to serialize that data as well as the tile map data.
thank the lawd, I have been getting failed imports from tiled - this actually looks easier to just do it direct. Ty so much for doing these.
Another great Video.👍
SPRITE ATLAS!!- you are the first person I have found talking about this, it solved a "shaky sprites" issue I was having with tilemap sprites in < 1 minute :). Thankyou
Another solution, if you are going for a pixelated look, is to change the filtering on the sprites from bilinear to point (no filtering). Sometimes these gaps are the result of the filter trying to interpolate the edge tile colors with non-color outside of the sprite, making the edge pixels semi-transparent.
You should really use a Composite Collider along with the Tilemap Collider. It drastically improves performance and simplifies the colliders so that each individual tile isn't producing a collider.
Yup good point!
Interesting
What if I were to add in, say, a tree using the same concepts. Would I then, be able to program the tree, to be able to be cut down?
How would I go about that? Would I have to hand place any sprites that have more functionality like that?
Hey Code Monkey, do you have a video of using 2D tilemaps in 3D, i have it sort of working however i cant seem to get palletes to work nicely with it, they appear like side perspective in pallete editor cells rather then seeing the tiles as squares like you would in a 2D game, if i use a GameObjectBrush i can select from the list and paint and it works fine, but i'd love to get the pallete working as it does in 2D so i can quickily select the objects to paint onto 2D grid
Great work bro. Please make a video about shooting method like apex legend
Nice video.
Thanks for the tutorial, I added a box collider 2d on my character and Tilemapcollider + Composite collider to my map, but my player is still passing throught
I LOVE THIS VIDEO I THOUGHT ABOUT THIS FOR 12 HOURS AND THEN U HELPED ME, WHO NEEDS BRACKEY'S WHEN WE HAVE YOU
Thanks for great guide! I am creating a tower defense game, So Towrs are only placed on the green grass. How can i make this work quick? how can i let the code understand that the area is the green one so that i can only place there? Like we did it on your tower defense course, we coded a radius and collider recognizition so that we cant put same object so near. So it needs to be similar idea. But i am new to tiles and i dont know how to do that (placing the tower only the green grass)
You can use Tilemap.GetTile to get identify the Tile on a certain position docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.GetTile.html
Then identify if that tile type is a valid building spot or not.
If your towers occupy more than one tile just test the neighbours as well.
Or maybe, add a tilemap collider onto the buildable tiles and do a physics query
Can you have mulitple layers? So you can have old school style parallax scrolling to give the illusion of depth
Yes I talk about different layers in the video. Although parallax would involve you moving the tilemaps ua-cam.com/video/wBol2xzxCOU/v-deo.html
Another easy fix for the cell gap is to make them 1 pixel less in the spritesheet edit section, so if it’s 16x16 tiles put 15 and there will be gap. The atlas is better but for quick jams or something that other method works fine. Btw is there a way to make a tile appear below characters when in front and above characters when behind according to its pivot? Or would that particular case require it to be an object? For instance if you have a second level (height wise) in the map, how do you be infront of the top portion cliff when on that second level, but then able to go behind for depth when on the lower level? Hope that makes sense xD
I can definitely see the sprite atlas thing as a quick fix that will likely cause issues in bigger more complex worlds.
bro the tile atlas literally saved me hours of work lol
Is possible to do a procedural tile map generator? Like scripting the width and hight of a room and let the code generate the tilemap? If you know how, pls let me know!
You can set a tile through code but this only handles the visual, the generation part can be done in a million different ways.
what would be your approach for making tile transitions from grass to sand, when your tilemap is procedurally generated? How can i put in the "mixed" tiles correctly? i would like to obtain "smooth" transitions and not see the square edges.
Either you draw some tiles with that transition and place them, or maybe you use a mask and a shader to do the transition, kind of like Unity Terrain
Great video
Can you make it have components for example when you put it its already have a script
(Sorry if my English is bad)
Yup, the tilemap runs on a normal game object so you can add scripts onto it and interact with the tilemap through code
@@CodeMonkeyUnity thanks
@Ahsan Azizan thanks
@@CodeMonkeyUnity i was searching how to do this
so, i have a some small sprites like in the video, but i also have a larger building spritle. i there a way to make that work?
Either split your building sprite into parts, or make a second tilemap with the size of the building
@@CodeMonkeyUnity ok thanks
thank for great tutorial. you can share assets of this tutorial
Code monkey my pc performance are so low he can only run old versions of unity that means the new plugins are so pointless for me do you think I must give up or keep on game development?
Sure you can use an older Unity version, you can build almost any game with old versions.
I started working with Unity 3 all the way back in 2013 and managed to build several very complex games with it.
@@CodeMonkeyUnity Wow well done thank you so much I will keep up on making games
I cant find Tile palette why?
@Code Monkey Pls help me!!! In my Scene I made many Emptys (Stages for the Endless Runner). I provided each of the with a Grid, so that I can put Tilemaps into them to easily create the platforms. But the Tilemaps have a lot more space than just the area that is filled with tiles. How can I fix this so that only the space where I drew tiles in is part of the tilemap object? Or is someting different correct? I googled a lot and I hope you will help me. Love your tutorials,
David
What do you mean by space? The Tilemap will only display where there are tiles, the empty space where there are no tiles isn't an issue
@@CodeMonkeyUnity I mean if I eraze tiles the map still is bigger. I just want to make moving platforms but I think the position of these makes the movement weird. Maybe the tutorial is just bad but I didnt find a really good one. If you make one I'd instantly like it.
You didn't explain why the atlas solves the gaps between tiles? Isn't the gap because you didn't get rid of filtering and compression on the sprites?
My Unity Editor crashed a couple times when I used Tilemap.
is there a wat to make it so you can only use the tilemap in certain locations?
way*
What do you mean? You can use it anywhere which means you can use it only where you want it
First 🥇
i am not getting the slice optiopn
Do you have a tutorial for 2d but with sideways view (platformer). I am making this and it is my goal to release my first game in 2021
I made a simple jump and double jump here ua-cam.com/video/DEGEEZmfTT0/v-deo.html
@@CodeMonkeyUnity Thanks!
@@XEAZUR did you do it
Can you made a video how to make a tile map in photoshop and export it
You just draw it in any image program you want, for exporting you just make an image, a PNG or JPG, anything works
Will you make an action platformer course?
By that do you mean enemies? The Platformer game doesn't have enemies but the Action RPG does so you can learn to be able to combine both into one game.
I just wanted a regular course from you regarding making action platformer. Just like your Builder-Defender course with regular programming and some advanced concepts like modular game design. There are not many teachers like you who explains so well. Thanks for replying.
@@KalponicGames I definitely expect the same )
How does it work with walk-behind tiles? Say, a tall tree?
You mean sorting? It should automatically sort things within the same tilemap automatically. As for having other dynamic objects in between the tiles I'm not entirely sure, I've only been using objects the same size as the tiles
@@CodeMonkeyUnity Yes, I meant interacting with the rest of the game. Characters walking through the scene, for example, or players being able to place object in the scene, and have other moving elements (npcs, critters, etc) be correctly sorted while moving around them.
EDIT: this, basically: preview.redd.it/zsrfe2239bv51.gif?format=mp4&s=0843b485f1092969390ae1135e60907d724ac2d1
Where did you make the sprites?
I drew them in Photoshop
@@CodeMonkeyUnity can you also do it with UPA toolkit? This is an asset for pixelart.
So~ I’m not the smartest and really want to figure this out. I’ve made a character and my tilemap. But my character is always under the tile map when I start the game…How can I fix this?
Check the sorting order unitycodemonkey.com/video.php?v=5_BwFB-1dAo
Also make sure the Z is on 0
Why not just turn off antialiasing to get rid of the gaps? That's only needed for 3D and might slightly improve performance to turn it off in a 2D game anyways, right?
It's also useful in 2D unless you're working with Pixel art
@@CodeMonkeyUnity I see. I don't do a lot of 2D stuff, so I wasn't aware of any other benefits to AA. But in a tilemap game it's often pixel art we're using anyway.
I have problem with organization of tilemaps. For example if you want to make something like forest you cannot use same tree tiles at same position.
You would need to use multiple tiles. Otherway is use the Z position in the tilemap. But also this makes difficult to eraese later because you don't know what Z position was used.
Also what if you designed a map part lets say gardenn, with fence and buildings, crops. And you want to have copy and paste? It does not work because you tile palette tools cannot copy multiple tilemap tiles and same time. That's are things which makes difficult to work with it.
I give you a scenario. You placed a building, you placed a wall as order 1 to draw it after the tree.. now you want to draw another tree as foreground.. so you use for this already 3 tilemaps. Now if you have followers and bushs your tilemap grows.
And now... if you have map areas with same setup.. you end up with tons of tilemaps.
I could’ve had this a month ago 😂
Where do i get the tile map textures
There's plenty of free texture packs on the unity asset store
@@CodeMonkeyUnity I was searching for one and I couldn't find a good one is there any you would suggest if so pls send link Thanks So much For The Reply.
Should probably take a look at the RuleTile, instead of rotating the same tile 3 different times.
In this case I don't think that would work since the edges are being placed on a second tilemap and not on the same one
@@CodeMonkeyUnity Yeah your right, I overlooked that.
Ker... Kermit...?
it isnt working
ok
~~~
dude when you make toutorials you need to cool down a little
You mean slow down? Everyone learns at a different pace so feel free to hit the pause button whenever you need to.
Just focus on making sure you understand what it is you're trying to learn regardless of how long it takes.
лучше бы сделали спрайт мап
WHYWHYWHWEYWEY SPRITE MODE DOESNT FUCKING EXIST WHYWHY HWEPOSG