It was a great tutorial. Thanks a lot. Could you please explain how can we use this to make simple board games such as dots and boxes? I am mainly interested to know how we can define objects on the board and move them horizontally, vertically or even diagonally by mouse click. I would be grateful if you could explain or even make another great video which is very helpful for beginners like me.
I know this is a year old but TY for doing this. However, could you maybe, possibly categorize this playlist a little more? Its a bit hard coming here after so much time has past, and trying to piece it all together. Even if you don't? still ty for doing these.
Hey John I don't know if you will even see this but thank you so much man, this tutorial really helped me out a lot on a game I was working on that needed some dynamic grid system for the UI/Canvas. I was really struggling on how to even start and wanted to just scrap the idea altogether until someone from your discord mentioned you made this video. Very helpful and very easy to follow tutorial, thank you once again!
Hey no probs! One of my first tutes, unfortunately I never finished the series as teased in this video. But a good starting point! Glad to hear you are back on track!!!
okay.... but now how to do you get an individual tile within that grid if you want something specific to happen to just one, like change color if pressed or whatever... And what if you don't want it centered?
I'm stuck at the point where you Instantiate grass tile straight from your resources file. Visual Studio won't find my GameObject or the folder in which the prefab is held. does anyone know whats wrong? I've tried renaming all items and folders and scripts.. everything to match yours exactly and it still won't work. did visual studio take this out method out and replace it with something else? I can't figure this out..
I want to update this GridHolder object on a click of a button ie. 4*2, 5*5, 3*2 based on the parameters passed. For me, the code is getting executed to generate the grid but it's not updating the UI. What can be done?
Can you LINK to the next-part of this tutorial for creating a road and a player move? Can't find from "playlist" or channel search! Naming of video title may be different?
Hi! Loved the video (subbed!), am really looking forward to a follow up on generating from a dataset, and possibly creating grids bigger than the screen, and being able to scroll around them!
Hi Jason, glad it was useful. Yeah the dynamic map from dataset was the initial plan here but i got side tracked by a platformer series. will return to this soon in a more meaningful way - maybe like a top down roguelite series or something.
hello. Thanks for uploading a nice video. I'm a college student new to Unity. I want to apply the contents of the video you uploaded to my 3D project, will it work the same if I apply the contents to 'canvas'? I'm talking about the canvas in the UI tab. This is what I was looking for, so I asked in a comment. Thank you. I use a translator so my words may not be smooth.
YO! I was so close to finishing this tutorial but for some reason my tile wasn't readable and my "GenerateGrid" thing wasn't valid either. I'm new to the coding scene so I only know a small sliver of coding info. If anyone can help me out as to how to fix this problem that'd be great!
If you want it to be completely random, you could do this: //Create 5 variants of the Tile prefab, each with your desired tile. //At the top of your script create 5 serialized GameObject variables. //Drag and drop your 5 tile prefabs in the inspector. //In the for loop: int randomNumber= System.Random.Next(1, 6); GameObject tileToInstantiate; //Create a switch statement... switch(randomNumber){ case 1: tileToInstantiate = tile_prefab_1; break; case 2: tileToInstantiate = tile_prefab_2; break; //....etc...... Then instantiate the tileToInstantiate variable in the for loop just like he showed in the video.
this's weird i made the object scrip but it was on writing file so i went to its source and opened as VS while writing the code litterly there was 0 error even tho i made alot of mistakes there was no error detected at all
Yes & no. If you are just trying to use it as a tilemap, then it's most likely a better idea to just use tilemap. But when you are making a system like this, it gives you the ability to extend the functionality of each tile in the grid. For example... You could implement the ability to click on each tile, and have every tile do something different. Or you could make it into a heatmap, where each tile stores an integer (temperature) & you could create rules for how the heat disperses. You could have a building system where when you click on one tile, and drag along a straight path down a row, it paves a road, etc etc. A good example of a game that does this is Terraria. They procedurally generate a grid of tiles that have more functionality than a standard tilemap. Whenever you click on a tile, a raycast is sent from the camera to the world position where the mouse-position is located. This starts a timer while you are holding the mouse button down on that tile. Whenever the timer finishes, that block gets destroyed, and an item gets instantiated at the same location to be able to be picked up in your inventory. All of that would be either impossible, or way too impractical to implement with unity tilemaps just by themselves.
Did you ever create the dynamic map tutorial? I am interested in creating something dynamic that I could change during gameplay, though what I am planning to do will be using letter tiles rather than floor tiles.
Late to the party, but in the 2nd for loop (the one creating the columns) Right after you create a variable "tile" that is of type "GameObject", which is the one instantiated... Two simple options... You can get the current color of the sprite renderer, and create a new color from it with a different ALPHA value. Or if you already know the color of it, you can just set it to that. option 1: Color startingColor = tile.GetComponent().color; Color newColor = new Color(newColor.r, newColor.g, newColor.b, x}; //Where x is the amount of opacity you want. tile.GetComponent.color = newColor; option 2: Color myColor; tile.GetComponent().color = myColor;
You could also create a SerializeField at the very top of your script that exposes the color in the inspector [SerializeField] private Color myColor; And then assign it to the Tile's Sprite Renderer Component in the for loop the same way I showed above. It's easier to select the color in the inspector, as opposed to messing around with the color's RGB values via code.
Your short videos are very interesting, I will look and test, it is very interesting to program a video, but I myself do not know how to program, and how learn how to program games?
Hey, i will try make some very basic videos for you. You should download Unity and do some tutorials! It will take time to learn, but we all have to start as beginners
Great question! It can be used in many types of classic-style grid based games; anything from original Zelda to top down rogue lites. This approach allows you to generate levels from a data set(or randomly with some additional logic), instead of placing everything by hand! Ill be sure to explore this in more depth in a follow up vid. Have a great day!
Do you interact with your viewers, or just upload content and hope to get views? If you do answer comments. How could you add a TEXT object dynamically just as a tile would be added to the Stage/Scene? I come from a Flash/AS3 background with programmable layers and a Stage. It's similar, but also way different.
Go to video to search how others implement this feature. Open it. Listen and look how author open unity and creates new project. Why? Why u do this? For bigger video time? Or u don't want cut some timing from your source video? Every who open this video he already now how to open unity and create damn project. OMG!!!! Literally 40% of whole video is regular project creation. And most important u for some reason call it "Dynamic Grid", but what is dynamic? Dynamic means this is not hardcode? Means that u can pass parameters to your grid holder? For me dynamic grid means solution which can hold resizable grid with performaly access to cell. Just time wasting
Having a hard time finding a tutorial that covers exactly what I need: stackoverflow.com/questions/63426940/what-is-the-best-way-to-dynamically-generate-3d-objects-on-a-grid-in-unity
@@user-ms9yk5ug3e I agreed, although several people's asked me why I would not use the new unity TileMap system. I looked at it and don't really see anyway to generate dynamic grids, or from external data, I could be wrong, but but seems like it's just for visual placement. It's this uncertainty that held me back a little from starting this dynamic grid 'rogue' style game series.
Hey guys! I'd love to get your feedback on the game I'm making, pls let me know what you think : ruclips.net/video/t4jnuktZm7I/видео.html
I hope you enjoy this tutorial! If you have any questions, leave them below and I'll be happy to answer.
It was a great tutorial. Thanks a lot. Could you please explain how can we use this to make simple board games such as dots and boxes? I am mainly interested to know how we can define objects on the board and move them horizontally, vertically or even diagonally by mouse click. I would be grateful if you could explain or even make another great video which is very helpful for beginners like me.
I know this is a year old but TY for doing this. However, could you maybe, possibly categorize this playlist a little more? Its a bit hard coming here after so much time has past, and trying to piece it all together. Even if you don't? still ty for doing these.
Simple and to the point, nicely done, Its there a way to create the grid using a sprite folder with multiple images without repeating?.
Can't wait for the next video. This feels like a solution which would scale nicely even for bigger games. Subscribed!
Hey John I don't know if you will even see this but thank you so much man, this tutorial really helped me out a lot on a game I was working on that needed some dynamic grid system for the UI/Canvas. I was really struggling on how to even start and wanted to just scrap the idea altogether until someone from your discord mentioned you made this video. Very helpful and very easy to follow tutorial, thank you once again!
Hey no probs! One of my first tutes, unfortunately I never finished the series as teased in this video. But a good starting point! Glad to hear you are back on track!!!
Exactly what I was looking for. For the love of God, please do the next Video.
Everyone: [SerializeField] private int
Me: public int
Thats the easy way out lol, just remember they're not quite the same
Exactly what I was looking for, thanks for teaching this
okay.... but now how to do you get an individual tile within that grid if you want something specific to happen to just one, like change color if pressed or whatever... And what if you don't want it centered?
I'm stuck at the point where you Instantiate grass tile straight from your resources file. Visual Studio won't find my GameObject or the folder in which the prefab is held. does anyone know whats wrong? I've tried renaming all items and folders and scripts.. everything to match yours exactly and it still won't work. did visual studio take this out method out and replace it with something else? I can't figure this out..
I get the same thing
I want to update this GridHolder object on a click of a button ie. 4*2, 5*5, 3*2 based on the parameters passed.
For me, the code is getting executed to generate the grid but it's not updating the UI. What can be done?
The final result doesn't look centered. Are you sure you need the 1/2 time offset? I think the 1/2 grid adjustment is enough.
4:02 I've got Visual Studio 2019 and Unity 2019.4 and I'm new in it. How I can do that?
after typing "for", press tab key two times
Can you LINK to the next-part of this tutorial for creating a road and a player move? Can't find from "playlist" or channel search! Naming of video title may be different?
Hi! Loved the video (subbed!), am really looking forward to a follow up on generating from a dataset, and possibly creating grids bigger than the screen, and being able to scroll around them!
Hi Jason, glad it was useful. Yeah the dynamic map from dataset was the initial plan here but i got side tracked by a platformer series. will return to this soon in a more meaningful way - maybe like a top down roguelite series or something.
Here is an invite to the discord if you want to talk gamedev:
discord.gg/yeTuU53
@@LostRelicGames Yes please! This is exactly what I'm looking for!
hey I want to build exactly that, did you get anything useful around it? Would be grateful for some links
Is there a way make grid have Id number instead of GreenBackground(Clone)(Clone)?
How can I use it for my isometric 2d game?
is this dynamic grid also applicable on making a Building game or management game?
Hey mate, yea absolutely, each cell could hold data related what is on the square , building, resource etc
hello. Thanks for uploading a nice video. I'm a college student new to Unity. I want to apply the contents of the video you uploaded to my 3D project, will it work the same if I apply the contents to 'canvas'? I'm talking about the canvas in the UI tab. This is what I was looking for, so I asked in a comment. Thank you. I use a translator so my words may not be smooth.
I am looking and I am not sure that I see a part 2 for creating multiple tiles on a grid.
YO! I was so close to finishing this tutorial but for some reason my tile wasn't readable and my "GenerateGrid" thing wasn't valid either. I'm new to the coding scene so I only know a small sliver of coding info. If anyone can help me out as to how to fix this problem that'd be great!
@Noam Stein Cool, I'll try that
I tried adding a background and the grid is not showing. help plss! :(
Change the order layer of the background to 0
how could we do this if the grid size changed randomly?
there will be a programming in C# video?
How can i randomize ^the tile so if I have 5 tiles I want to be randomly mixed how could I do that?
If you want it to be completely random, you could do this:
//Create 5 variants of the Tile prefab, each with your desired tile.
//At the top of your script create 5 serialized GameObject variables.
//Drag and drop your 5 tile prefabs in the inspector.
//In the for loop:
int randomNumber= System.Random.Next(1, 6);
GameObject tileToInstantiate;
//Create a switch statement...
switch(randomNumber){
case 1:
tileToInstantiate = tile_prefab_1;
break;
case 2:
tileToInstantiate = tile_prefab_2;
break;
//....etc......
Then instantiate the tileToInstantiate variable in the for loop just like he showed in the video.
@@subliminalcastillo2126 Thanks!
Hello Thanks for the tutorial. Is it possible to use button prefabs in this grid?
Hey Jessie, you should be able to instantiate any type of prefeb that suits using this approach.
What's the recommended amount of pixels for a tile
this's weird i made the object scrip but it was on writing file so i went to its source and opened as VS while writing the code litterly there was 0 error even tho i made alot of mistakes there was no error detected at all
Very cool. I'm leaving the like in the tutorials I'm doing.
Does this have any advantages over the Unity tilemap system?
Yes & no.
If you are just trying to use it as a tilemap, then it's most likely a better idea to just use tilemap.
But when you are making a system like this, it gives you the ability to extend the functionality of each tile in the grid.
For example...
You could implement the ability to click on each tile, and have every tile do something different.
Or you could make it into a heatmap, where each tile stores an integer (temperature) & you could create rules for how the heat disperses.
You could have a building system where when you click on one tile, and drag along a straight path down a row, it paves a road, etc etc.
A good example of a game that does this is Terraria. They procedurally generate a grid of tiles that have more functionality than a standard tilemap. Whenever you click on a tile, a raycast is sent from the camera to the world position where the mouse-position is located. This starts a timer while you are holding the mouse button down on that tile. Whenever the timer finishes, that block gets destroyed, and an item gets instantiated at the same location to be able to be picked up in your inventory.
All of that would be either impossible, or way too impractical to implement with unity tilemaps just by themselves.
hello, could you teach how to make a system of planting seeds and harvesting?
Did you end up making a follow up to this!?!?
Is there anyway to modify the matrix or even delete it?
If you push the tiles into a multi-dimensional list/array you should be able to reference them through index
Is there anyway to make the grid with your own object type. I have a class called Cell which holds values as well as a png sprite.
Why is my grid infinite when the dimensions are 1x1?
Did you ever create the dynamic map tutorial? I am interested in creating something dynamic that I could change during gameplay, though what I am planning to do will be using letter tiles rather than floor tiles.
I can ask a question, I am a Kazakh from Kazakhstan, I wanted to know how you feel about programming and how you learn languages?
i taught myself to program when i was young, i bought some books and practiced by making very simple games!
Hey, great tutorial. I was wondering how can I change opacity of grid
Late to the party, but in the 2nd for loop (the one creating the columns)
Right after you create a variable "tile" that is of type "GameObject", which is the one instantiated...
Two simple options... You can get the current color of the sprite renderer, and create a new color from it with a different ALPHA value.
Or if you already know the color of it, you can just set it to that.
option 1:
Color startingColor = tile.GetComponent().color;
Color newColor = new Color(newColor.r, newColor.g, newColor.b, x}; //Where x is the amount of opacity you want.
tile.GetComponent.color = newColor;
option 2:
Color myColor;
tile.GetComponent().color = myColor;
You could also create a SerializeField at the very top of your script that exposes the color in the inspector
[SerializeField] private Color myColor;
And then assign it to the Tile's Sprite Renderer Component in the for loop the same way I showed above.
It's easier to select the color in the inspector, as opposed to messing around with the color's RGB values via code.
Your short videos are very interesting, I will look and test, it is very interesting to program a video, but I myself do not know how to program, and how learn how to program games?
Hey, i will try make some very basic videos for you. You should download Unity and do some tutorials! It will take time to learn, but we all have to start as beginners
In 2019 have already component GRID for 2D game ... Is sad to make this when have already component and is easy for make collision, visual etc ...
GREAT TUTORIAL. THANKS
really nice tutorial
but how can i make it stay on the scene
Very Good and Helpful video, man! Great job! Its a sub from me!!
Thank you so much, I am glad you found it useful!
Interesting video. What is the purpose in a dynamic grid when making a 2d game?
Great question! It can be used in many types of classic-style grid based games; anything from original Zelda to top down rogue lites. This approach allows you to generate levels from a data set(or randomly with some additional logic), instead of placing everything by hand! Ill be sure to explore this in more depth in a follow up vid. Have a great day!
Is this for 2d platformers?
dose anyone have the script i can use?
Why is GridW negative?
There isn't a followup?
create a game bingo, how card bingo ?
How I can get this responsive? I have many Tiles and they should scale that I can see all on the screen. Nice Vid :)
Really nice video, i was searching for this exact thing!
Thanks Fuego! Glad to have helped you
Do you interact with your viewers, or just upload content and hope to get views? If you do answer comments. How could you add a TEXT object dynamically just as a tile would be added to the Stage/Scene? I come from a Flash/AS3 background with programmable layers and a Stage. It's similar, but also way different.
If you want someone to help you stop asserting rude things into your comments and instead ask nicely. Dear god.
i need to get more familiar with unity. been postponing it for far too many years...
Here is an invite to the discord, come hang out, talk dev, and find inspiration :)
discord.gg/yeTuU53
Go to video to search how others implement this feature. Open it. Listen and look how author open unity and creates new project. Why? Why u do this? For bigger video time? Or u don't want cut some timing from your source video? Every who open this video he already now how to open unity and create damn project. OMG!!!! Literally 40% of whole video is regular project creation. And most important u for some reason call it "Dynamic Grid", but what is dynamic? Dynamic means this is not hardcode? Means that u can pass parameters to your grid holder? For me dynamic grid means solution which can hold resizable grid with performaly access to cell. Just time wasting
That's rough, buddy.
thank you so much
Having a hard time finding a tutorial that covers exactly what I need:
stackoverflow.com/questions/63426940/what-is-the-best-way-to-dynamically-generate-3d-objects-on-a-grid-in-unity
great, but how can you make a character move in the grid
Hey I'm planning a follow up on this soon; thinking to make it into a full game series. Enemies, random movement, collectables etc.
That sound good, its very hard
To find content of grid based games in unity
@@user-ms9yk5ug3e I agreed, although several people's asked me why I would not use the new unity TileMap system. I looked at it and don't really see anyway to generate dynamic grids, or from external data, I could be wrong, but but seems like it's just for visual placement. It's this uncertainty that held me back a little from starting this dynamic grid 'rogue' style game series.
@@user-ms9yk5ug3e I'm a big fan of manually creating and populating grids through these loops. It gives more control and power to developer.
it`s slow, very slow. You need to use tilemaps and Grids with Tilebase. Make tutorial about it, please)
You should enable skippable ads :)
perfect
Nice
Thanks Daulet, i'm glad you enjoyed it!
ffs why it is so fucking hard to create a map ?