Grid Building System - City Builders, RTS | Unity Tutorial

Ойындар

An easy tutorial on how to make a grid based building system in Unity. You don't need to write a custom grid! The system works with standard Unity tilemaps. It implements grid snapping and placement checking. As an example, I used an isometric grid but it will work for any 2d grid.
Get the project files - www.patreon.com/posts/project...
Grid placement is a very common mechanic used in simulation games, tycoon and city builders, rpg and rts games. I developed this system when I was making my fantasy town simulation game Lost in Athilidus. In my devlogs, I share a lot of useful resources so you can learn how to make a game in Unity by yourself.
HayDay style building system (based on this one) - • Grid Building System T...
3D Grid Building System in Unity - • 3D Grid Building Syste...
0:00 Intro
0:24 How the system works
1:04 Setting up the project
3:28 Time to code!
12:28 How to make it better
14:18 Outro
You can use the code in your projects but you're required to credit me (include link to this video)
Starting project
github.com/TamaraMakesGames/G...
Final project with extra feature (smooth movement) available on Patreon
Lost in Athilidus Devlogs
• LiA Devlog - Indie game
----My Links----
💗 Patreon 💗
/ tamara_makes_games
☕ Buy me a coffee ☕
www.buymeacoffee.com/tamarama...
⭐ Discord ⭐
/ discord
🔷 Twitter 🔷
/ tamaramakesgame
🎮Games🎮
tamara-m.itch.io/
👍 Like and Subscribe! 👍
#GridBuilding #UnityTutorial

Пікірлер: 209

  • @user-by2kc8dl6w
    @user-by2kc8dl6w2 жыл бұрын

    Thank you for awesome tutorial! And I saw some guys saying like this "When I click/place the house it doesn't seem to paint the tiles green " For this guys, I think you can solve it by making Resources folder in your Assets Folder. In this video, string tilepath = "@Tiles/ " and Resources.Load(tilePath + "white") this means they call Tile(named "white") in "Tiles" Folder in "Resources" Folder. sry for my poor expression :m I mean... Assets/Resources/Tiles/"tile name you want to call"... this! I hope it helps you.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you for commenting! I think your clarification will help a lot to others

  • @Fearofthemonster

    @Fearofthemonster

    Жыл бұрын

    I also had to remove "@" for it to work. What is it supposed to do anyway?

  • @alexdubarenco4297

    @alexdubarenco4297

    Жыл бұрын

    Sadly still does not work for me. Even specifically making @"Resources\Tiles\" folders to locate the tiles. However making the game in 3D with downloaded TileGrid package.

  • @CahitbeyAdiAlinmis

    @CahitbeyAdiAlinmis

    Жыл бұрын

    This is helpful. But it still says "An item with the same key has already been added. Key: White". I think thats the problem why it wont paint the floor green if its placeable. Yeah i paint it white, the code checks if its white, like code doesnt want to paint it white it just check it so i dont know why its giving me ArgumentException error.

  • @Test-kx9ek

    @Test-kx9ek

    7 ай бұрын

    You can also serialize a field for each tile type in the inspector without needing the path

  • @trapshooter
    @trapshooter2 жыл бұрын

    awesome tutorial! I think it's the only grid tutorial I've seen that implements multi-tile buildings. Keep it up!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks! I've seen some tutorials that implemented a custom grid but I wanted something easier. That's why I came up with this system.

  • @Driver-qt9jh
    @Driver-qt9jh10 ай бұрын

    NGL, this tutorial just single handedly showed my how to make my code read-able. I had no idea you could create sections in the editor for methods. Thanks for the help!

  • @godtierslayer3046
    @godtierslayer3046 Жыл бұрын

    Awesome Video Tamara keep em comin! For everyone else here is a heads up! IMPORTANT: The tile system is case-sensitive This means that... If you type "Green" on the tile asset in the project folder and then type Resources.Load(tilePath + "green")); " in the start code then it won't work! If you type "green" on the tile asset in the project folder and then type Resources.Load(tilePath + "green")); " in the start code then it will work! Hopes this helps someone!

  • @rolo1632
    @rolo16322 жыл бұрын

    You don't know how much you helped me 🔥🔥🔥 Great tutorial

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you! I'm so glad to hear this!

  • @SexyBlueTiger
    @SexyBlueTiger2 жыл бұрын

    This was an incredibly well done tutorial.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you! I'm actually new to this format so any feedback is appreciated.

  • @unityalexdev
    @unityalexdev2 жыл бұрын

    It was nice to realize you have now 5.5k subs and in the video it's only 152, congrats!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks! Yeah, this video is actually the first tutorial I ever made. And it really took off

  • @uiosun1932
    @uiosun1932 Жыл бұрын

    I love your style: quick action and normal speed say, the time is very compaction!

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    Thank you for telling me this! I am glad that you like it!

  • @nichegames9590
    @nichegames95902 жыл бұрын

    That's really cool. I think the methods used here could be used for a lot of different projects.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    It's great to hear! I really hope this video helps someone to make their game

  • @violanze8484
    @violanze8484 Жыл бұрын

    I realy dont unterstand minute 3:10 - 3:20...how you get the 3 "empty" Tiles?

  • @Shronkey
    @Shronkey2 жыл бұрын

    Really good tutorial! Keep it up :D

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you! I'm glad you liked it!

  • @brandonjacksoon
    @brandonjacksoon2 жыл бұрын

    Thank you! Awesome tutorial ;)

  • @ascendo_lee
    @ascendo_lee Жыл бұрын

    Thank you! This tutorial was very helpful for me! :D

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    I'm glad you liked it!

  • @davidReyGD
    @davidReyGD6 ай бұрын

    Superb tutorial, thank's a lot

  • @smartbucket9415
    @smartbucket94152 жыл бұрын

    Nice and simple!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks!

  • @meiner9047
    @meiner90472 жыл бұрын

    Thank You for this Tutorial serie

  • @n8dev
    @n8dev2 жыл бұрын

    great stuff!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks!

  • @LMEthan
    @LMEthan3 ай бұрын

    How do you make it that if you place a building in front of another building it has higher priority on the layer compared to if it is placed behind it has a lower priority?

  • @ngjiayi2705
    @ngjiayi27052 жыл бұрын

    Hey! Can I ask a quick question, I think I might have missed out something. How do I solve error CS0246: the type or namespace name ‘TileType’ could not be found From Building.cs

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! You have to create an enum TileType. It has to contain values Empty, White, Green and Red as far as I remember

  • @user-gv2rm5qr6p
    @user-gv2rm5qr6p2 жыл бұрын

    Hey, I was trying to learn something new with your coede, it's really cool as I am just a beginnger. I've got some questions though: why are you using "Tiles\" path in the dictionary if you aren't creating a separate folder in assets? And are you sure that slash is in the right direction? I am asking because my indicator tilemap isn't changing colors...

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! You can load tiles in another way just to see if everything works. For example, create fields for them and populate in the inspector. As for the resources, I checked with Unity documentation and turns out you're right. The slash should be in another direction. Thank you for noticing and sorry for the confusion.

  • @user-gv2rm5qr6p

    @user-gv2rm5qr6p

    2 жыл бұрын

    @@TamaraMakesGames Do you think I can serialize the textures in the begining of the script? Or do I do that in the enum TileType? I've checked all the code and I think it's all right, but strongly believe the issue lies in the script not seeing textures for different tile types...

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Try serializing them at the beginning of the script and then initializing them in the editor. Then in the Awake method you can add them to a dictionary. Also, did you try just creating a folder named Tiles in the Resources?

  • @TheSolsboer
    @TheSolsboer Жыл бұрын

    How do you save your changes to tilemap?

  • @Alex-fp2sx
    @Alex-fp2sx2 жыл бұрын

    it's amazing , thanks very much

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks!

  • @PurpleNut
    @PurpleNut2 жыл бұрын

    Hi o/ This Video really helped Thank you for making this tutorial !

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Glad it helped!

  • @Fearofthemonster
    @Fearofthemonster Жыл бұрын

    Creating an empty object and adding it the sprite caused the prefab and the sprite to be instantiated at different positions for some reason. I just skipped using the empty object and used the sprite as the building object

  • @ursoNordway
    @ursoNordway2 жыл бұрын

    good tutorial

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you!

  • @zac_coonan
    @zac_coonan Жыл бұрын

    Thanks for the awesome video I have one question though, I am making my game for mobile and instead of the space bar placing a building, how do I make it so my "place button", does that instead?

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    Thank you! I'm glad you like the video. As for your question, you can create a public method that has the same code as the if that checks for the spacebar input (should be just a Place() call or something) and then attach it to a button.

  • @zac_coonan

    @zac_coonan

    Жыл бұрын

    @@TamaraMakesGames Thank you so much

  • @SpaceflightGuy
    @SpaceflightGuy Жыл бұрын

    Sorry to ask this but: How would one go about only having white tiles around green/red tiles? I want a system that requires you to "connect" all of your buildings, so I need to check if the nearbvy Space is red/green before beeing able to place something on the white tile there.

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    I would modify the method that checks placement availability. Instead of just checking for empty cells for the building placement I'd also check neighboring cells to not be empty. Or you can go the other way and set white only the neighboring cells of a placed building. But that wouldn't account for the next building's size so maybe you should combine the two approaches - first one for functionality, second - for indication. And don't be sorry for asking! It's totally okay to ask questions 🙂

  • @mlgkhush
    @mlgkhush2 жыл бұрын

    Hey! Awesome tutorial, but I have a small question. This works for the objects I want to build, but if I want to generate objects on the grid (for example trees or rocks) how can I make them part of it? (Also dunno how to instantiate prefabs in random positions connected to the grid XD).

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hey there! Thanks! You can build a separate spawner class that is going to be responsible for storing all the possible objects to place. Then, choose them randomly and choose the position from a certain range. If you want to make sure it already fits the grid you can generate only whole values for coordinates like 0, 1, 2... Also, to avoid double conversions you can modify the method InitializeWithObject to accept a ready position on the grid. For example, you can do this by making a parameter of type bool that'll indicate if the position is already on grid or in world space. Then check that bool and do the calculations for the position only if necessary.

  • @TrustInJus1in
    @TrustInJus1in2 жыл бұрын

    Hi, how did you create the green red white tiles @ 3:16? I have the option to create various rule tiles but not a simple tile like those

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I just changed the color sprite on the regular white tile

  • @goldenjustin9841

    @goldenjustin9841

    3 ай бұрын

    @@TamaraMakesGames it doesn't help be more specific pls

  • @worldtrending24.76
    @worldtrending24.7616 күн бұрын

    hi the link of patreon you shear not working pls ineed the code

  • Жыл бұрын

    awesome tutorial!, Do you have one on how to create isometric water with reflections and everything?

  • @PK-se2jh
    @PK-se2jh2 жыл бұрын

    thankyou soo much :)

  • @bagins1338
    @bagins133811 ай бұрын

    Hey! I was wondering how to make that building could only be moved by gragging, I mean that if you just click somewhere building wouldn't teleport there.

  • @TamaraMakesGames

    @TamaraMakesGames

    11 ай бұрын

    Hi! I recommend checking out these other videos. They are about similar building systems but with dragging components included. 2D - kzread.info/dash/bejne/ZZih262Tp5nPZc4.html 3D - kzread.info/dash/bejne/pH-km8iQptCvp9o.html

  • @mikeypettengill4642
    @mikeypettengill4642 Жыл бұрын

    Can you please elaborate on "make it a prefab"? I do not see how you did this step. With both objects selected, I right click and my only "Prefab" options are "Select Root" and "Unpack".

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    Drag the selected object from the hierarchy to the project files

  • @namkikim2098
    @namkikim2098 Жыл бұрын

    Thank you for the tutorial!! One suggestion: Could you make your mouse pointer visible? It's kinda difficult to catch up where you're clicking

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    I'm glad you liked it! And thanks for the suggestion, I already implemented it in more recent tutorials.

  • @OrionContratamosParaDiarista
    @OrionContratamosParaDiarista7 ай бұрын

    Can you make a tutorial on a map like Mount & Blade that has a menu to enter cities and markets? I think it's a bit difficult, some say

  • @richardguilliams7278
    @richardguilliams72782 жыл бұрын

    I must be missing a step. in the update function if(EventSystem.current.IsPointerOverGameObject(0)){ return; } console says that the name EventSystem does not exist in current context. am i missing a using directive or do I need to declare a new eventsystem?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    You just need to import Unity's EventSystems

  • @TheProGuyComedy

    @TheProGuyComedy

    Жыл бұрын

    @@TamaraMakesGames How do you import unity's EventSystem

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    @@TheProGuyComedy Just write using UnityEngine.EventSystems; at the beginning of the script file

  • @TheProGuyComedy

    @TheProGuyComedy

    Жыл бұрын

    @@TamaraMakesGames thanks. I had been searching and that was the result. But I forgot to add an s after event system. Lol

  • @VagrantZero
    @VagrantZero2 жыл бұрын

    If I wanted to paint the building prefabs onto a tilemap instead of instantiating them as game objects, how would I do that? Thank you for the tutorial!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    That would require a custom tilemap brush with game object. The system will be a lot different. Thanks for commenting!

  • @keventy6114

    @keventy6114

    Жыл бұрын

    If the buildings are in your Tile Palette (or set as tile assets), I don't see why you can't have another Tilemap called Buildings or something on a layer that renders before the ground and then use SetTile? Unless SetTile is currently not working in Unity.

  • @kong3748
    @kong3748 Жыл бұрын

    could you make a 2D platformer in unity series

  • @Onthequestionof
    @Onthequestionof2 жыл бұрын

    Awesome video and Thank You for doing it. I'm completely new to coding in unity and would like to take this specific project and make it with mobile touch controls instead. How would i go about doing that? I tried following your hayday videos but the code is too different and so much more than what i needed to understand how to do this. I'm such a noob. Thank you again.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hello! I'm glad you like the video! As for the mobile input, I was about to tell you about my HayDay series but since you have tried that already I can say that you can find some beginner video tutorial on this topic and also look for it in Unity documentation. Hope it helps 🙂

  • @supremecai5857
    @supremecai58572 жыл бұрын

    For some reason (although everything looks identical in scene/scripts) When I click/place the house it doesn't seem to paint the tiles green :) (at ~10:00) also how did you paint the white tiles so fast?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! Try checking if you add differently colored tiles to the dictionary. Then maybe check if you have a line of code where you set a new colored tile. Also, positions are important. Maybe something is wrong with them. I don't think that the problem is with loading tiles (some people had it) because in that case you would get empty tiles (null) or even an error. You can change the color of a tile in the editor. Look in the inspector for the color field. It is only possible if you have plain white tiles.

  • @supremecai5857

    @supremecai5857

    2 жыл бұрын

    @@TamaraMakesGames I don't seem to, I copied everything exactly up to that point. If anything it could be an editor thing with position or something? Position of what exactly, and where should it be?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Check area size in your prefab. It has to have z set to 1 and not 0. Also, check the position you set your tile on. Maybe something wrong with it. If you still have problems, you can write in my discord server in the help channel and provide more information about your problem. Maybe other people who have developed this system will be quicker to help you or I will look at it personally.

  • @robotrobsen2592
    @robotrobsen25922 жыл бұрын

    Hi! First, thanks for the video. It is really informative. I tried to port the tutorial to a 3D space and discovered a weird behavior. When clicking to move the building around, it only moves upwards (along the y-axis), no movement at all in the plane space (neither in x- nor in y-direction). I already tried to play around with different Vector2 and Vector3 assignments, unfortunately without any luck til now. May someone kindly give me a hint what to do to stick the building to the ground and move it along the x-/z-axis?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi there! I don't recommend using the input you see in this video for a 3D project. But it is great that you mentioned. I will be posting a tutorial for a grid building system in 3D very soon! You can subscribe and turn on the notifications 🙂

  • @atthiyya
    @atthiyya2 жыл бұрын

    Hi! May i ask, where you put the "FillTiles" and GetTilesBlock" ??

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    In the Building System script. If that's what you meant.

  • @atthiyya

    @atthiyya

    2 жыл бұрын

    @@TamaraMakesGames Thank u for kindly reply me, can i ask once more? i dunno why the green tile is above of the house, maybe u know why this is happen. Anyway sorry for my bad english, it's not my first language

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    @@atthiyya You might have forgotten to set the building sprite sorting layer to 1. It will make it appear above the tilemap which is on the layer 0 by default. I hope it helps! Your English is good, don't worry! When I said "if that's what you meant" I thought that maybe you meant to ask where these methods are called.

  • @atthiyya

    @atthiyya

    2 жыл бұрын

    @@TamaraMakesGames I see! Thank u very much T^T u rlly helps me, ur tutorial really awesome, thank uuuu

  • @fanti8957
    @fanti89572 жыл бұрын

    how can I add touch camera movement and zooming? also how can I make it for mobile instead of computer (i know I have to switch platform from windows to android/iOS but I don't know how to change inputs)? btw thanks for the awesome tutorial. maybe I'm asking for too much but I hope u can help me

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! Thank you for commenting! Actually, I will be posting a video on this topic soon so subscribe and turn on the notifications to watch it when it comes out 🙂

  • @fanti8957

    @fanti8957

    2 жыл бұрын

    @@TamaraMakesGames thank u. I'm looking forward that video. subscribed!

  • @andresbocchigliere3227
    @andresbocchigliere32272 жыл бұрын

    I dont understand how did you create Tiles at 3:14. i dont know hot to create tiles or add colors to them... Someone can help!?

  • @stuckinghabit6612

    @stuckinghabit6612

    2 жыл бұрын

    Right click in the project window >> "Create" >> "Tile". Then click on it and in the inspector you can change the color and sprite.

  • @danielzupan2516

    @danielzupan2516

    2 жыл бұрын

    Right click in project window and Create -->2D --> Sprites --> Isometric Diamond

  • @amisma468

    @amisma468

    2 жыл бұрын

    in tile palette: right click -> select tile asset -> click on color box and adjust

  • @The_N14
    @The_N142 жыл бұрын

    Script GridBuldingSystem add only to Grid and to TempTIlemap or/and MainTIleMap? Bulidng add only to house or to hause and sprite?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    GridBuildingSystem -> Grid Building -> House prefab

  • @The_N14

    @The_N14

    2 жыл бұрын

    @@TamaraMakesGames I do not understand

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    @@The_N14 Grid is the parent object for both tilemaps. You have to add the GridBuildingSystem script ONLY to the Grid object. House prefab is a parent object for the sprite. Add the Building script ONLY to the parent object (House prefab).

  • @user-jj7un2dw9t
    @user-jj7un2dw9t2 жыл бұрын

    The video helped me a lot! Thank you! There is only one problem, but I think the tile map's Red, Green, Empty, and white are not recognized. I think the file path in the start part is wrong, so can you explain the path code in detail?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! I'm very glad that you found this video helpful. You can look up loading from resources in Unity's documentation. I think I might have messed up the slashes in the path. Also you can just set up fields for tiles and populate them in the editor if you struggle with resources.

  • @doitph4278

    @doitph4278

    2 жыл бұрын

    Hello! I have the same problem, may I ask if you manage to solve it? 🥺

  • @user-jj7un2dw9t

    @user-jj7un2dw9t

    2 жыл бұрын

    @@doitph4278Did you solve that problem? If not, creating a resource file and creating a tile file in it will solve the problem.

  • @doitph4278

    @doitph4278

    2 жыл бұрын

    @@user-jj7un2dw9t yes I just figured it out 5 hours ago, thank you for the response! 😇

  • @doitph4278

    @doitph4278

    2 жыл бұрын

    @@user-jj7un2dw9t Hello did you continue this project? Can I ask more questions? 😅

  • @jahyukshin4239
    @jahyukshin42392 жыл бұрын

    Hi I'm glad to see your Video. your video is Awesome! I'm sorry it's too late to ask, but I have a little problem in this tutorial. when I press Escape key after building placed, the building is destroyed but the area is remain. so I can't place another building in this area. I hope you can answer my question.

  • @jahyukshin4239

    @jahyukshin4239

    2 жыл бұрын

    I solve this problem by assigning null to temp after placing temp. Is this correct solution?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Yes, that's correct

  • @straydogstrut115
    @straydogstrut1152 жыл бұрын

    Thanks for sharing. This is a really clear, detailed tutorial😊 Can I ask how you made your sprites? They look like 3D objects you saved as images?

  • @straydogstrut115

    @straydogstrut115

    2 жыл бұрын

    I just found your other video. This probably answers my question😊 kzread.info/dash/bejne/ipmlrbN7ecSaY8o.html

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thank you! Actually, they are 2D isometric sprites. I mostly use free assets for my current game Lost in Athilidus and the house you see in the tutorial comes from there. These buildings are constructed from different 2D blocks like walls, roofs, doors etc. I only change them to match my game art style. I have a short video speed up of this process - kzread.info/dash/bejne/eZl60piinry9YLA.html

  • @Kingxter10
    @Kingxter102 жыл бұрын

    Hi there, awesome Video, but i still can figure out why the tiles not changing colour. Adding a prefab and moving it around works perfect. Everthing seemed to be right, except of the colouring tiles.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks! Try checking if you add differently colored tiles to the dictionary. Then maybe check if you have a line of code where you set a new colored tile. Also, positions are important. Maybe something is wrong with them. I don't think that the problem is with loading tiles (some people had it) because in that case you would get empty tiles (null) or even an error.

  • @Kingxter10

    @Kingxter10

    2 жыл бұрын

    @@TamaraMakesGames I think the code is everything right, because i copied your script from patreon. What do you mean with positions?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Can you please message me in discord? We can discuss this further so I can help you

  • @ronygankin4158
    @ronygankin41582 жыл бұрын

    Hey, great guide, is there a change you can show the dragging scripts?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Thanks! The full script for a house with drag and drop is going to be available on my Patreon page soon. For now you can just look for a tutorial on drag and drop in Unity. It is pretty easy, to be honest.

  • @ronygankin4158

    @ronygankin4158

    2 жыл бұрын

    @@TamaraMakesGames I found a few, yet they do not work well with the grid, I'm getting an offset after the initial instantiation

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    @Rony Gankin I had the same problem. Just offset the position where you instantiate a house. This worked for me: position = gridLayout.CellToLocalInterpolated(cellPosition + new Vector3(.5f, .5f, 0f));

  • @ronygankin4158

    @ronygankin4158

    2 жыл бұрын

    @@TamaraMakesGames I'm working on it in the building script so I should just reference the grid from the grid script and have that line after the instantiation?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I do the instantiation in the grid script so this line goes before it. But you can do it in the building script if you wish.

  • @thatonedm4555
    @thatonedm45552 жыл бұрын

    Could someone please explain how I create a new sorting layer?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I was talking about sprite sorting layer. In the SpriteRenderer component (on the House sprite object) find a drop-down called additional settings. There you will find the sorting layer and sprite order

  • @thatonedm4555

    @thatonedm4555

    2 жыл бұрын

    That clears things up thankyou

  • @Scheny-Dev
    @Scheny-Dev2 жыл бұрын

    Hi! You really helped me a lot! But I didnt understand how to replace a building after it was placed. From what I`ve tried, I replace all the buildings that I placed so far instead of the single building. Can you explain please how you did it or can you make a video about it? Thanks a lot!!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! I am so glad that I could help you! What do you mean by "replace"? You mean move to another spot?

  • @Scheny-Dev

    @Scheny-Dev

    2 жыл бұрын

    @@TamaraMakesGames yes, exactly. You explain it at the end of the video, but I didn't quite understand it.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I have made another video with a similar building system where I covered moving the building. Here is the link - kzread.info/dash/bejne/ZZih262Tp5nPZc4.html Hope it helps 🙂

  • @Scheny-Dev

    @Scheny-Dev

    2 жыл бұрын

    @@TamaraMakesGames Yes, it helped me! I just added 5 lines of code, I needed to ClearArea more often haha. Thanks a lot! I subscribed, the videos are very helpful!

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    @@Scheny-Dev That's great! I am super glad that you found what you needed. Also, thank you for subscribing!

  • @wentee2864
    @wentee28642 жыл бұрын

    How do building move with the mouse?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Set up an Update function to constantly check for mouse position and move the building to it

  • @quijanys
    @quijanys Жыл бұрын

    Hi, great tutorial! It worked great. I wanted to leave a comment because I am still a bit new on the Tilemap system and I made a novice error. I mistakenly placed the tile SPRITES on the resources/tiles folder, and not the tile object that generates from the tile palette. Hope this helps someone else!

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    Hi, I'm glad you liked the tutorial! And thank you for providing additional information

  • @ilhamsa01
    @ilhamsa012 жыл бұрын

    Awesome.. How do you remember those code?... I think is hard to learn Game Dev instead Web dev...

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Lol, I dipped my toe into web dev when I studied it at university but I didn't like it at all. So it's always been gamedev for me. And about remembering code - there is always Unity Documentation if you forget something. And you know, the whole Internet for that matter :-)

  • @another_day4783
    @another_day47832 жыл бұрын

    Does this only work for 2d or will it work for 3d games?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    This system only works for 2D. Tilemaps are 2D objects, they cannot be used in a 3D project.

  • @_VeonAlmeida
    @_VeonAlmeida Жыл бұрын

    moving object on mouse click not working !!...is it 'cause i made a 3d project??

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    For 3D projects I recommend this tutorial on grid building system - kzread.info/dash/bejne/pH-km8iQptCvp9o.html

  • @_VeonAlmeida

    @_VeonAlmeida

    Жыл бұрын

    @@TamaraMakesGames THANK U :)

  • @muffafaYoutube
    @muffafaYoutube2 жыл бұрын

    Can i use this code for my 2d project with 2d flat tilemap. where should I change in this tutorial?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! You mean rectangular grid, right? Yes, you can. You should only change the type of grid and maybe adjust the sprite offset on the building prefab

  • @muffafaYoutube

    @muffafaYoutube

    2 жыл бұрын

    @@TamaraMakesGames yes. How should i adjust to the spirite offset? I changed pivot on my house to bottom right and it seems it works? Is that correct? Also Do you have suggestion for save load system?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    If it works you don't need to change it. That is great that you didn't need any adjustments. I think I mentioned a good saving system in one of my devlogs... But you can also looking my Discord server (channel resources). It should be there too!

  • @muffafaYoutube

    @muffafaYoutube

    2 жыл бұрын

    @@TamaraMakesGames thank you so much. do you have linkedin account?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Yes, why'd you ask?

  • @youtuberyoutuber2495
    @youtuberyoutuber2495 Жыл бұрын

    So this whole thing will work no matter what our grid size is?

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    Yes, I tested it myself.

  • @bube123
    @bube1232 жыл бұрын

    i really like your tutorials, but pleaaasee, get into some details, like how you create those sprites called tiles.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I am glad to know that you like my tutorials. I appreciate the feedback. I leave these simpler things out to make the videos shorter. But as for this particular moment you mentioned I have another video where I am explaining Unity tilemaps in more detail. Link - kzread.info/dash/bejne/epZ_xNqHZrLVZqw.html

  • @playplus5386
    @playplus53862 жыл бұрын

    does anybody know what should i need to learn before watching this tutorial again ?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Here's a video about Unity tilemaps that you'd wanna watch before jumping to the tutorial - kzread.info/dash/bejne/epZ_xNqHZrLVZqw.html

  • @wongaiintelligencestudio
    @wongaiintelligencestudio2 жыл бұрын

    Where to copy the coding part?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Source code and project files are available on my Patreon - www.patreon.com/tamara_makes_games

  • @fanti8957
    @fanti89572 жыл бұрын

    sorry for asking, maybe I'm late but I followed the tutorial one full day straight and it's still not working... i don't know why... should u please help me?

  • @fanti8957

    @fanti8957

    2 жыл бұрын

    my bad i fixed: i added the building script to the house after making it a prefab, so the instantiate made a prefab with no building script. it's crazy how i've been work in unity for 1 year and u know 10 times what i do

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I'm glad you figured it out! I am still learning and discovering new things about gamedev in Unity. Btw, if you have any other questions, I recommend checking out my discord server. There are a lot of cool gamedevs who can share knowledge with you. I answer questions about my tutorials there too. Here is the link - discord.com/invite/dCJBpe2meg

  • @fanti8957

    @fanti8957

    2 жыл бұрын

    @@TamaraMakesGames thanks a lot u r the only 1 KZreadr who answers me

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    I like chatting with my audience when I can 😀 So many interesting and skilled people are here!

  • @fanti8957

    @fanti8957

    2 жыл бұрын

    @@TamaraMakesGames well I'm not one of those but it's okay ahahaha. didn't published one game yet :(

  • @3DGD
    @3DGD Жыл бұрын

    How us this for 3D?

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    You can watch this tutorial for the grid building system in 3D - kzread.info/dash/bejne/pH-km8iQptCvp9o.html It uses the same principle but it is fitted for 3D space

  • @3DGD

    @3DGD

    Жыл бұрын

    @@TamaraMakesGames Thank you!

  • @anxikax
    @anxikax11 ай бұрын

    3:39

  • @axelwallenrod3718
    @axelwallenrod37182 жыл бұрын

    Hi, im trying to understand the line: if (EventSystem.current.IsPointerOverGameObject(0)) { return; } Why it do nothing if the point is over the object? Is not needed it to move the prefab?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    This line prevents mouse clicks going through UI elements

  • @cbr9731
    @cbr97312 жыл бұрын

    I love you!!!

  • @theplaymakerno1
    @theplaymakerno12 жыл бұрын

    Ah, you use Rider! A Person of class :)

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    So much more comfortable to work in it!

  • @theplaymakerno1

    @theplaymakerno1

    2 жыл бұрын

    @@TamaraMakesGames Yes

  • @Fearofthemonster
    @Fearofthemonster Жыл бұрын

    I couldn't find the code in the github.

  • @TamaraMakesGames

    @TamaraMakesGames

    Жыл бұрын

    That's right, I only shared the starter project there. The full project is available on my Patreon

  • @wongaiintelligencestudio
    @wongaiintelligencestudio2 жыл бұрын

    Where can I download this hole project file?

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Project files are available on my Patreon page

  • @user-et7de8in7k
    @user-et7de8in7kАй бұрын

    need this in 3d bro

  • @TamaraMakesGames

    @TamaraMakesGames

    Ай бұрын

    Here you go - kzread.info/dash/bejne/pH-km8iQptCvp9o.html

  • 8 ай бұрын

    Hello, Thank you for all the videos, that must be a lot of hard work. I am following this one and I get a weird error within the FillTiles function saying that "TileBase[] does not contain a definition for 'length'" Can anybody give me a hint for that ? Thanks.

  • @TamaraMakesGames

    @TamaraMakesGames

    8 ай бұрын

    Hi! I appreciate your comment. I hope my content is helping you. As for your question, TileBase[] is an array so it has a property Length that returns the size of the collection. You're probably getting an error because you have to start the word Length with a capital letter. If you did that and are still getting errors, then check if the TileBase is still an array, maybe you changed the type to List. Lists have the property Count to retrieve the size

  • @theplaymakerno1
    @theplaymakerno12 жыл бұрын

    For some reason, why building is not snapping the way yours is.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Snapping is handled in the Update method in the if statement which detects a button click. Make sure that you have a line of code where you assign the local position of the house to a new position and snap it to grid.

  • @theplaymakerno1

    @theplaymakerno1

    2 жыл бұрын

    @@TamaraMakesGames Another thing that isn't working is the erasing of the tiles. I managed to fix the movement issue. The tiles get painted but they are not getting erased. Probably something wrong on my end.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    @@theplaymakerno1 In the method follow building make sure that you called the ClearArea() method. If yes, then check if your method works well. Check if the size of an array is calculated properly and the prevArea is changing (not in this method, but in the Update)

  • @theplaymakerno1

    @theplaymakerno1

    2 жыл бұрын

    @@TamaraMakesGames I found the mistake. Thank you and God bless you for providing this solution.

  • @Dorphie
    @Dorphie2 жыл бұрын

    They way you say everyone almost sounds like my name which was disconcerting.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    LoL, hi Aaron! 😅

  • @augustlewen2149
    @augustlewen21492 жыл бұрын

    Everybody here seems to have no problem following this tutorial, saying it is super clear. I haven't learned a thing and it's super hard to keep up with. You got through everything so fast and barely explain anything. I have no idea how you could draw the tiles with the tile palette. Never done that before and I try to follow your steps but I don't get what I'm doing wrong. "Now you can go back to unity and paint some white tiles", well no I can't do that. What am I missing? Wish this tutorial was like 45 minutes long, where you explain more in detail your code and also don't go through everything so fast.

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Hi! I'm sorry you had difficulties following this tutorial. This material is for more experienced users. I'm preparing a video which will answer your questions. I'm trying to make it more beginner-friendly.

  • @talismanskulls2857
    @talismanskulls2857 Жыл бұрын

    A few issues with your video and its mainly your skipping over parts, sharing only your pre-made assets and rushing through everything which is hard on people with such as audio and visual impairment. 1) You are not showing HOW you made the "ART" or how to measure the Asset sizes. You do that with the Grids, you need to do that with the ART meant to align to the grids. 2) If your going to show scripting as part of the tutorial you need to take it step by step without rushing through it. This also means if you are granting usage of the code and implying its in the project, it needs to be in the github, not used as a lure to get someone to have to join your page to have access. That is very misleading to people and you should consider stating in this on this page 'SCRIPTS NOT INCLUDED WITH PROJECT ASSETS.' Good luck.

  • @Grinwa
    @Grinwa2 жыл бұрын

    woow i though your a boy am not joking... and woow that was so cool

  • @TamaraMakesGames

    @TamaraMakesGames

    2 жыл бұрын

    Lol, I wanted to do a face reveal after some time but when I published this video I totally forgot that I have a photo on GitHub.

  • @seersdduR
    @seersdduR Жыл бұрын

    I love you so much~ :) Marry me plz

  • @nixonrulez
    @nixonrulez5 ай бұрын

    Add these Debug.Log's in your Start() method: private void Start() { ................. tileBases.Add(TileTypes.White, Resources.Load(tilePath + "possiblePlacementTile")); // Debug logs to check if tiles are loaded Debug.Log("Empty Tile: " + (tileBases[TileTypes.Empty] == null ? "null" : "Loaded")); Debug.Log("Green Tile: " + (tileBases[TileTypes.Green] == null ? "Failed to Load" : "Loaded")); Debug.Log("Red Tile: " + (tileBases[TileTypes.Red] == null ? "Failed to Load" : "Loaded")); Debug.Log("White Tile: " + (tileBases[TileTypes.White] == null ? "Failed to Load" : "Loaded")); } Otherwise you will go crazy

Келесі