No video

Create a grid in Unity - Perfect for tactics or turn-based games!

  Рет қаралды 242,662

Tarodev

Tarodev

Күн бұрын

Пікірлер: 373
@Tarodev
@Tarodev 3 жыл бұрын
NOTICE: If you're having trouble seeing your tiles, ensure your sprite renderers alpha are set to 255. Sometimes it defaults to 0. Part 2 has been released: kzfaq.info/get/bejne/nJugoJVq3s7FhKc.html It includes additional functionality like unique tile logic, game flow, unit moving and attacking! Did you enjoy the video? Let me know so I can continue making helpful content!
@smileychess
@smileychess 2 жыл бұрын
Yup, the alpha channel was the problem. Took 20 minutes to figure it out (even after reading your message here, because I'm stupid). Thanks!
@WorkingDev
@WorkingDev 2 жыл бұрын
@@smileychess new to unity and this is my first time dabbling in it. Where do you find this setting?
@smileychess
@smileychess 2 жыл бұрын
@@WorkingDev - It's in each of the places that you set the color. It's the last slider, labeled "A" and has a range of 0 to 255. Crank that up to 255 so it's not transparent.
@themonkeysadvocate3265
@themonkeysadvocate3265 2 жыл бұрын
@@smileychess *2 hours for me XD
@lillylyddon9869
@lillylyddon9869 2 жыл бұрын
You should really pin this to the top.
@jikosauce
@jikosauce Жыл бұрын
Even the simplest tasks seem impossible if you don't know how unity works, it's like looking at the flying board for a plane
@theroboman727
@theroboman727 3 жыл бұрын
For the offset bool you could use: (x + y) % 2 == 1
@theroboman727
@theroboman727 3 жыл бұрын
also maybe: x % 2 != y % 2
@Tarodev
@Tarodev 3 жыл бұрын
You're right! That's much cleaner.
@DuniC0
@DuniC0 2 жыл бұрын
Yeah! I thought the same! (x+y) it's called Manhattan distance and with the modulus of 2 you can get a perfect checkboard
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@overcomeaging
@overcomeaging 2 жыл бұрын
or: (x % 2 == 0) ^ (y % 2 == 0)
@jameslavery2958
@jameslavery2958 2 жыл бұрын
All that in under 9 minutes! Tutorials are on par with the best on YT. Thanks.
@Umbra00000
@Umbra00000 9 күн бұрын
This is a great video! You were able to communicate in such a way that I was able to understand what you were doing and how the code works.
@ksalarang
@ksalarang Жыл бұрын
Few minutes into the video and I already knew that this is an instant like and a sub
@Tarodev
@Tarodev Жыл бұрын
Hope you enjoyed the rest ❤
@glebozhgikhin1528
@glebozhgikhin1528 2 жыл бұрын
Most understandable grid tutorial ever! Thank you! I had problems with activating hilight object, and solved it with adding hilight color field into "Tile Script", and empty "backupColor" variable, that saves renderer color on mouse collision enter.
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@nyx0103
@nyx0103 2 жыл бұрын
These tutorials are really clear, concise and you also explain some of the principle behind the code instead of just saying "type the code that I am typing and it will do what you want". I am subscribing. This tutorial is giving me an idea to make a small game for my portfolio, thanks a lot.
@Tarodev
@Tarodev 2 жыл бұрын
I'd love to see what you end up making 👌
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@awildmoose6798
@awildmoose6798 2 жыл бұрын
show me where he explains the principle behind the code. he didnt do it once.
@larryd9577
@larryd9577 2 жыл бұрын
Instead of casting _width and _height to floats, you can divide them by 2f, it will result in a float.
@kitteninamitten5735
@kitteninamitten5735 3 жыл бұрын
The visual studio text is too small, pretty difficult to read. Other than that pretty good tutorial.
@nakano15
@nakano15 2 жыл бұрын
I think they fixed that on 2022, but at the cost of performance hahah.
@paulglosemeyer2451
@paulglosemeyer2451 2 жыл бұрын
Imagine not liking this video... perfect video! Short, clear, easy to follow. Keep going!
@nyaenya
@nyaenya Жыл бұрын
Thank you for this wonderful tutorial! I was wondering why my colors didn't alternate after I added the sprite renderer and isOffset boolean, turns out my colors were all transparent! Make sure to check whether your Alpha value is at 255 to avoid the same problem I had :')
@pandasempie
@pandasempie Жыл бұрын
LOL I was about to have the same issue ty T_T
@pseudoleviathan5923
@pseudoleviathan5923 Жыл бұрын
Same issue thank you!
@chrisdaly6023
@chrisdaly6023 Жыл бұрын
you kept me from facing a huge headache.. thanks!
@goodymicplaysgaming
@goodymicplaysgaming Жыл бұрын
I was soooooo confused as to why it wasn't working, thank you.
@squabbler_
@squabbler_ 2 жыл бұрын
I looked for any sort of video tutorial, blog post, etc explaining this in 2020. Thank you so much!
@lln6123
@lln6123 2 жыл бұрын
The Cameraposition based on the size of your grid was what I needed!
@soco5338
@soco5338 2 жыл бұрын
Clear, concise instruction without fast forwarding to a speed no realistic human could follow. Probably(why lie? you definitely are) one of the top three cleanest and most efficient coders for Unity tutorials on KZfaq.
@Tarodev
@Tarodev 2 жыл бұрын
Damn bro
@MarcosacroM
@MarcosacroM 2 жыл бұрын
Thanks for the tutorial, was very cleary and for non english speacker it was very simply to understand you without subtitles.
@VikkersOlfsson
@VikkersOlfsson Жыл бұрын
This is a magnificent tutorial, thanks champ!
@CharlieVanders22020
@CharlieVanders22020 2 жыл бұрын
Absolutely brilliant tutorial, thank you very much for your work!
@Tarodev
@Tarodev 2 жыл бұрын
I'm glad you enjoyed it :)
@zoop391
@zoop391 Жыл бұрын
Personally, I think storing the grid in a data structure such as a two-dimensinal array is nice to work with. To extend this, if we had a three-dimensional array we could store layers of grids, that could represent house floors, underground floors, etc.
@dpurrington
@dpurrington 9 ай бұрын
That's the model Minecraft uses. Every square "foot" is of one material or another. Air is just another material that you can pass through.
@jirikropocev9911
@jirikropocev9911 2 ай бұрын
Very nice video: clear, informative and easy to understand. Thank you!
@jugibur2117
@jugibur2117 3 жыл бұрын
Watching this at 50% speed but wish you could pause 2-3 seconds after you swapping the screen, so I have time stopping the video and finish typing :-) But anyway, your videos are very helpful, so thanks for your effort!
@Tarodev
@Tarodev 3 жыл бұрын
I do feel like I swap between windows a bit more than I should. I'll try keep it in mind for my future videos!
@Shokukumi
@Shokukumi 3 жыл бұрын
Would look forward to more board game type of videos!
@Tarodev
@Tarodev 3 жыл бұрын
I just released part 2: kzfaq.info/get/bejne/nJugoJVq3s7FhKc.html :)
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@SlimeWithClass
@SlimeWithClass 3 жыл бұрын
Would you be able to give an example of how to use the GetTileAtPosition function? Just to do something like displaying that tiles name to a debug menu or change a clicked tile to a different color?
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@noobcraft5712
@noobcraft5712 3 жыл бұрын
You should mix in some devlogs that will be sooo cool.
@Tarodev
@Tarodev 3 жыл бұрын
Very good idea. I'll do that! Also, I took your advice and started a discord. I'll drop the link in a video or two when it's ready
@noobcraft5712
@noobcraft5712 3 жыл бұрын
@@Tarodev oh :)
@andubunea9627
@andubunea9627 3 жыл бұрын
@@Tarodev OH can t wait to see the discord I think I will really get help with unity from there
@treppas
@treppas 2 жыл бұрын
Great video, really taught me a lot of stuff in a short time.
@mrbooscloos2431
@mrbooscloos2431 Жыл бұрын
instead of centering the camera on the gird i wrote: Instantiate(_tileprefab, new Vector2(x - 4.5f, y - 4.5f), Quaternion.identity); its alot easier and if it doesnt line up properly then you need to play around with" 4.5f"
@ngjiayi2705
@ngjiayi2705 2 жыл бұрын
you're my fav tilemap guy right now!!
@Tarodev
@Tarodev 2 жыл бұрын
Wait until you see part 2 😉
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@sulin8517
@sulin8517 9 ай бұрын
Thank you for your tutorial, that's a nice way to create a grid.
@mewpsy1000
@mewpsy1000 Ай бұрын
Ty so much dude.
@Tarodev
@Tarodev Ай бұрын
@@mewpsy1000 no problem 😊
@Programming_Buddy1
@Programming_Buddy1 2 жыл бұрын
Great video! straight to the point.
@matthewjames7513
@matthewjames7513 2 жыл бұрын
Great video! I followed the whole thing and duplicated it perfectly on my end. However, when I run it, I find that the tiles are not visible to the camera. The green colors do not show up. However, I can tell that the core functionality still works because the highlight comes up as I move my mouse around. I'm using Unit 2020.3.29, maybe that's why? :) Thanks for the tutorial!
@matthewjames7513
@matthewjames7513 2 жыл бұрын
Nevermind! I figured it out from a previous comment of yours. For those that don't know this is what you need to do: 1) Click on "Tile" so that the inspector tab on the right shows up 2) Change the alpha of the Base Color and Offset Color 2a) When you click on the color a separate screen comes up where you can choose the RGBA values. Move the slider from 0 to 255.
@gamingcodingwithrandoms1187
@gamingcodingwithrandoms1187 2 жыл бұрын
@@matthewjames7513 thank you
@garvisan6540
@garvisan6540 2 жыл бұрын
@@matthewjames7513 thank you so much
@dustinwallace9301
@dustinwallace9301 2 жыл бұрын
@@matthewjames7513 Had the same issue. Thanks for clearing it up!
@birdblue6927
@birdblue6927 2 жыл бұрын
Thanks a lot!!! 👍👍👍👍
@edmondeyeemceeezekiels9158
@edmondeyeemceeezekiels9158 Жыл бұрын
Much love for this!
@soninh4357
@soninh4357 2 жыл бұрын
Thank you alot. Im learn how to make a game rn, this guide help me alot
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@DroolingNoob115
@DroolingNoob115 2 жыл бұрын
When instantiating your dictionary it may be good practice to pass in the capacity (width * height in this case) of it as to not consume more memory than necessary whenever the dictionary needs to resize its capacity as you add more tiles. It may be also be worth to consider using a 2d array if you are nit picky about performance and memory as you don't have to save a key for each tile. I would only suggest this if you plan to make a giant array however, may not be necessary or even optimal for small projects.
@Tarodev
@Tarodev 2 жыл бұрын
Good tips. I avoid 2d Arrays like the plague and opt for more user-friendly devices. Unless performance is an issue, as you said.
@hayali9302
@hayali9302 2 жыл бұрын
@Tarodev Thank you brother, I learn so much from you.
@rafaelokabe
@rafaelokabe 2 жыл бұрын
You saved me tons of hours of work!
@yuuki85
@yuuki85 Жыл бұрын
wow it in detail works! Very good job
@phildebondi8311
@phildebondi8311 2 жыл бұрын
Hi I'm just getting started with Unity, I'm sure I've messed up something simple. Whenever I call the Tile.Init(Bool) function all of the tiles are positioned in the one spot and the color doesn't change. Any help would be appreciated.
@andressblabla
@andressblabla 2 жыл бұрын
Would you mind explaining why you prefered to self-create a Grid system instead of using the actual Unity Grid and Tilemap system? I'll be really glad if you do so because I've already seen another youTuber's take on Grid as well (CodeMonkey's) and both of you decide to create your own versions instead of using Unity's. Is there a reason for that? Thanks in advance!
@Tarodev
@Tarodev 2 жыл бұрын
Just answered your question in discord! ❤️
@coreybuchan34
@coreybuchan34 2 жыл бұрын
Hey, so this is a great tutorial and I was wondering if you could clarify the _renderer.color = isOffset ? _offsetColor : _baseColor; Is that just an if/else statement written in a single line? _renderer.color = (if ifOffset is True, _offsetColor, else _baseColor)?
@kordeyrow
@kordeyrow 2 жыл бұрын
Yes, it's a ternary operator
@theresnothinghere59
@theresnothinghere59 2 жыл бұрын
fast, clever video, amazing!
@oguzsurer9397
@oguzsurer9397 8 ай бұрын
You deserve more subs thank you for the tutorial.
@BakedFrame
@BakedFrame Ай бұрын
For anyone who can get the highlight to appear change the layer for the Highlight 2D object to 1.
@lluisvinent9099
@lluisvinent9099 2 жыл бұрын
Aren't these 'OnMouse' methods actually a raycast? I guess that for huge grids it would be more performant to create a single raycast from the mouse position and check what's colliding instead of a script for each tile. Anyways, I love your content. I'm recomending your videos to a noob friend of mine who is starting with Unity. He's super motivated thanks to your videos! :)
@Tarodev
@Tarodev 2 жыл бұрын
Thanks for the recommendation ;)
@imamdarwin3750
@imamdarwin3750 2 ай бұрын
Instead of moving the camera I instantiated my tiles as my gridManager's childs and moved my grid manager to -_height/2 , -_length/2. This way tiles are still starting from the position 0,0 relative to their parents.
@BossAleks123
@BossAleks123 Жыл бұрын
If anybody has invincible tiles, dont forget to change where you change the color the saturation.
@Tarodev
@Tarodev Жыл бұрын
Ensure alpha on the sprite renderer is not set to 0
@BossAleks123
@BossAleks123 Жыл бұрын
@@Tarodev yes 👍🏽
@supergogogo
@supergogogo 3 жыл бұрын
Very useful tutorial! thank you very much
@TheRotomFan
@TheRotomFan 2 жыл бұрын
Great video! I'm following along, but for some reason the Init function is making all the tiles not visible to the camera. I'm not sure how to fix this. I'm on 2021.2.7f1 if that matters.
@againstallevens8512
@againstallevens8512 2 жыл бұрын
Make sure your alpha on the color is set to 255 rather than 0.
@theemeraldsloth9570
@theemeraldsloth9570 Жыл бұрын
Thanks for this. This was super good and simple
@gregotox
@gregotox 2 жыл бұрын
the new brackeys is looking good.
@Tarodev
@Tarodev 2 жыл бұрын
You're too kind ❤️
@eddyrc7
@eddyrc7 2 жыл бұрын
Saw your video in reddit, decided to sub, will be back today and get this tutorial going, thanks for this!
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@chubbychuck2118
@chubbychuck2118 Жыл бұрын
Very good tutorial!
@amrutvijapur8057
@amrutvijapur8057 Жыл бұрын
Can somebody help me? I've done everything the master said in the video character to character. After adding the code to change the color of the tiles, the tiles stopped appearing and yes my sprite renderer was not turned off.
@leeblackharry
@leeblackharry 2 жыл бұрын
How would you go about creating an outline around each grid cell instead of coloring each grid cell like you did in this example? I tried adding in an Outline component but this did not work.
@Handler643
@Handler643 Жыл бұрын
Hi, I am getting an error like this can any one please Help me? UnassignedReferenceException: The variable _renderer of Tile has not been assigned. You probably need to assign the _renderer variable of the Tile script in the inspector.
@billpariss9559
@billpariss9559 Жыл бұрын
You have to drag and drop the Tile object into the Renderer field, like he does at 6:31 with the Highlight.
@issaraychouni1570
@issaraychouni1570 2 жыл бұрын
best easy board ever
@christostsonis344
@christostsonis344 2 жыл бұрын
lol this is the first tutorial I see naming a spwned object so it never occured to me that was possible
@matthewmathis62
@matthewmathis62 2 жыл бұрын
This is very useful, thank you!
@brittanypruneau3377
@brittanypruneau3377 3 жыл бұрын
Any ide why none of the tiles show a color? I can see the outline of them when I click on them, but the base color and offset color are not showing up when I click play.
@Tarodev
@Tarodev 3 жыл бұрын
On your sprite renderer make sure you alpha (r, g, b, alpha) is pulled to the right. Sometimes it defaults to 0
@DarkstalkerFly
@DarkstalkerFly 3 жыл бұрын
@@Tarodev Thanks, that was the problem
@matthewcraft7457
@matthewcraft7457 2 жыл бұрын
@@Tarodev How do you change it? All my tiles are created with the alpha set to 0?
@UngelisteteVideosvonExes
@UngelisteteVideosvonExes Жыл бұрын
rly good video man
@thanhhainguyen3553
@thanhhainguyen3553 Жыл бұрын
FACTS!!!!!! Thank you so much man, you're the best!!!!!!!!!
@earth2772
@earth2772 4 ай бұрын
哇哦,太酷了bro,非常感谢你的教程👍
@alexhere4061
@alexhere4061 2 жыл бұрын
Amazing!TYSM!!!
@DeezyCobain
@DeezyCobain 2 жыл бұрын
It’s not working.. I’m gettin a singular tile not the full grid
@alexhere4061
@alexhere4061 2 жыл бұрын
Try to debug your code
@dksanime9343
@dksanime9343 Жыл бұрын
Completely agree. Aweso video
@DuniC0
@DuniC0 2 жыл бұрын
You can use Manhattan distance for the checkboard pattern: (x+y)%2
@playboyy21
@playboyy21 2 жыл бұрын
Yo checkout this template for a grid tactics game , this one is by far the best ive seen so far kzfaq.info/get/bejne/ntd5dLeBmqiwkYU.html
@fess24
@fess24 3 жыл бұрын
Thank you so much!
@larryd9577
@larryd9577 2 жыл бұрын
Level up your boolean game! In calculating the offset one might want to use (x%2) ^ (y%2). This is the xor operator and it is true, if both values are different, so 1 ^ 0 == true and 0 ^ 1 == true and false otherwise.
@MisaGuitarist
@MisaGuitarist 2 жыл бұрын
And level up again: (x+y)%2
@xHartii
@xHartii Жыл бұрын
Nice tutorial
@LeoCow
@LeoCow 2 жыл бұрын
hey, i am having trouble trying to shrink it down. i want to make it all 10x smaller, so x=1 y=1 is now x=0.1 y=0.1 do you know how i could do this?
@dusklights6810
@dusklights6810 2 жыл бұрын
Hello, Just wondering how the GetTileAtPosition function is supposed to be used? Every way I have tried to use it, it has returned a null value and never a tile.
@nanoux
@nanoux 2 жыл бұрын
Awesome tutorial man, you just got a new subscriber :) I have a question for you, how different would be the process of achieving this, but in 3d? i.e Final fantasy tactics or Vandal hearts, in which the world is isometric 3d and you can rotate the camera in 4 angles?
@Tarodev
@Tarodev 2 жыл бұрын
Easily transferable to 3d. Replace the sprite renderer with a mesh renderer and replace the y axis for z 😀 Welcome aboard buddy 👍
@okuABR
@okuABR 2 жыл бұрын
Thankyou for this
@LocalContentShow
@LocalContentShow 2 жыл бұрын
Feel like I'm kind of falling at the first hurdle here, I don't have the option to make a 2D object. I thought it might be something about Unity's weird multiple render pipelines but no matter if I use URP or specific 2D, nope, still no 2D objects?
@sealer1675
@sealer1675 3 жыл бұрын
Hey! Is this system incompatible with the inbuilt Tilemap/Grid system of unity? Fx. You're making a custom Tile class, while there already exists one in the Tilemap package of unity.
@Tarodev
@Tarodev 3 жыл бұрын
Tile maps are great, but they're certainly not suitable for most grid games. For example, you can't attach unique logic to a certain tile (easily) using tile maps. One example would be if you had one tile which was a pressure plate which opened a door on another tile... That's very difficult to do using the tile map system.
@sealer1675
@sealer1675 3 жыл бұрын
@@Tarodev i see, I was thinking wether or not it would be possible to have both a unity tilemap and a custom grid on top - with unity tilemap used just for tiles and a custom grid for logic
@izme3830
@izme3830 2 жыл бұрын
Thanks, good video :)
@canadianmodder7403
@canadianmodder7403 2 жыл бұрын
Can this work with Hexagon tiles? Your video is very helpful
@McGreir
@McGreir 2 жыл бұрын
My tiles are invisible, any idea why? I can see that they are created in the scene but they have no color in neither game/scene
@Tarodev
@Tarodev 2 жыл бұрын
Check the opacity on the sprite renderer. For some reason they can default to 0. The a in rgba
@McGreir
@McGreir 2 жыл бұрын
@@Tarodev Yup thanks a lot, that was it!
@Tarodev
@Tarodev 2 жыл бұрын
@@McGreir happy coding 😊
@Tarodev
@Tarodev 2 жыл бұрын
@Balint Ujvari You're right! I pinned it.
@rayaqin
@rayaqin 2 жыл бұрын
@@Tarodev cheers : ) 🎉
@thumbwiz
@thumbwiz 2 жыл бұрын
For me, the tiles are being instantiated 1 pixel apart rather than the size of the tile, which in my case is 75. "var spawnedTile = Instantiate(tilePrefab, new Vector2(x, y), Quaternion.identity);"
@Dead_Seconds1058
@Dead_Seconds1058 6 ай бұрын
i don't know what fails, but i can't put my tile prefab into the grid manager, as he does at 1:28 i would appreciate some help
@Gears2Game
@Gears2Game 6 ай бұрын
The field is looking for a "Tile", try to attached the Tile.cs to the tile prefab.
@mrussogamedev
@mrussogamedev 4 ай бұрын
life saver @@Gears2Game
@Edit-nk6nb
@Edit-nk6nb 3 жыл бұрын
This was helpful, but not well explained. This would show you how to do it, but not why you're doing things, along with it being very fast between transitions. Things such as the spawnedTile section - I knew what was happening as I have messed around with grids in GMS2, but if I hadn't I wouldn't know whats going on. I didn't really learn what any of the functions did, so I spent time googling most steps to understand what I was writing.
@Tarodev
@Tarodev 3 жыл бұрын
Good feedback. I'll try to explain each line more clearly in the future. Thanks for this.
@SmokinKipper
@SmokinKipper 3 жыл бұрын
But that’s the idea right? What he shows is just the start. Now you go research each of those functions and build something unique with each of them.
@Nova04550
@Nova04550 2 жыл бұрын
Wondering if you could zoom in more on these tutorials because watching them on mobile is quite a pain!
@Moon-cr4mu
@Moon-cr4mu 2 жыл бұрын
amazing
@shiratasakusharane7714
@shiratasakusharane7714 2 жыл бұрын
Nice tutorial, thank you :) However, I have face the problem in the highlight section as the highlight color doesn't show up at all when I place my mouse to the tiles. Do you have any advice to fix it? Ps: My tiles are "Sprite Image" instead of "Color" and it seems like my Unity doesn't have the option "2D -> Sprite -> S̶q̶u̶a̶r̶e̶" for some reason...
@Tarodev
@Tarodev 2 жыл бұрын
Do you have the sprite 2D package installed I'm package manager? Make sure your highlight alpha is not sitting at 0. Make sure the sorting order is higher than your tile.
@Ukysseus
@Ukysseus 2 жыл бұрын
I have the exact same problem, did you find the solution? When my mouse pass over any tiles, the original tile lights up
@jaylonreidhead157
@jaylonreidhead157 2 жыл бұрын
I finally figured it out!!! I had to replace the Tile object in my assets with the Tile object (with highlight stacked on it) from my scene. That way the script takes my uodated Tile with the highlight asset every time it makes a new block.
@user-hs1np1os9p
@user-hs1np1os9p Жыл бұрын
What are the different ways to highlight tiles in Unity? What if I need to cast a shadow under object I am going to put? How to highlight tiles that are already occupied and those that are free?
@evergreen8488
@evergreen8488 Жыл бұрын
Thank you sooo mch
@tuckbuckk5465
@tuckbuckk5465 2 жыл бұрын
What's the difference between this and the grid component
@Tarodev
@Tarodev 2 жыл бұрын
Do you mean unity tile maps? Although they have their place, tilemaps give you very minimal control over tile logic. They make it basically impossible to link tiles, for example a lever and a trap door tile. Creating your own always gives a much more flexible result. Downside is if you want handmade maps you'll need to build a simple editor
@aku8261
@aku8261 2 жыл бұрын
Hey there, I'm new on unity programming and I was trying to follow the turotial but for some reason the "Init" in 5:07 gives me an error... I copied everything from the code correctly, I don't know what could be wrong...
@theulfhednar2655
@theulfhednar2655 2 жыл бұрын
things worked fine :O . Though my tiles keep dissapearing visually. They are there! just, not visible :/
@Tarodev
@Tarodev 2 жыл бұрын
Check the alpha on the sprite renderer. It's probably at 0
@theulfhednar2655
@theulfhednar2655 2 жыл бұрын
not only that, but I only get tiles up to 8 8. after that it stops
@Tarodev
@Tarodev 2 жыл бұрын
@@theulfhednar2655 obvious thing first: is your width and height set to 8 in the inspector?
@theulfhednar2655
@theulfhednar2655 2 жыл бұрын
@@Tarodev They weren't, I even increased to 22 on the width at one point, and it stayed at 8. 8x8, perfect square.
@theulfhednar2655
@theulfhednar2655 2 жыл бұрын
@@Tarodev do you think making it a public variable would do any difference (Im kinda new to programming so idk :P )
@user-rv9dp8gw8c
@user-rv9dp8gw8c 8 ай бұрын
Why is the Value data type in the dictionary the Tile Class, not the GameObject?
@BatuhanTerzi1
@BatuhanTerzi1 Жыл бұрын
Hi everyone and Tarodev, I love to use events like OnMouseEnter etc. but can you tell me if there is any performance difference between onmouseenter-exit and raycast system? I love to use both of them. Which one should we choose?
@BatuhanTerzi1
@BatuhanTerzi1 Жыл бұрын
Hi everyone again, if there is anyone seeking an answer for this subject, I chatted with chatGBT and it's saying if there are so many objects with an onMouseDown-Enter-Exit type event on it, using Raycast is more efficient.
@seleg3163
@seleg3163 Жыл бұрын
I have a problem with the camera the width is fine but the height go beyond the boundaries of my camera and I have no clue how to fix it
@nehal_chandra2777
@nehal_chandra2777 3 жыл бұрын
Thanks alot.
@savagefox3530
@savagefox3530 3 жыл бұрын
is it possible to use a tile set this way tell it to grab certain tiles from a tile set to do a random generated grid map
@Tarodev
@Tarodev 3 жыл бұрын
You can add tile variance as you loop through and set the tile. Add specific tile types with certain weights and roll a dice to determine what to place. If this doesn't make sense come into discord and we'll chat.
@st0rmpr0of
@st0rmpr0of 6 ай бұрын
Hey! Thanks for the tutorial! How would you do this method with a flat-top hexagonal grid?
@Tarodev
@Tarodev 6 ай бұрын
Checkout my more recent grids video, which shows how to position tiles for all types of grids. You can use the position logic of that video with the game play logic of this one
@JianqiuChen
@JianqiuChen 2 жыл бұрын
Good pace! The video is a bit blurry, hard to see the code on my screen.
@Astamor
@Astamor Жыл бұрын
Isn't it kinda redundant to create grid when tilemap itself is already a grid ? It contains methods for specific tiles, tilemap size, etc ?
@Tarodev
@Tarodev Жыл бұрын
Tilemap is good for some things, but is hugely limited on intractability. For example, having one tile linked to another tile in some way (lever/door) is very tricky and requires ugly workarounds.
@Astamor
@Astamor Жыл бұрын
@@Tarodev Is it tricky tho ? Firstly you place door and lever as objects on separate layer of tilemap then just use event system to interact with them. I think it's actually much simpler way of doing it. I usually use 3 tilemaps, ground(walkable), obstacles(unwalkable) and objects(everything that you can interact with).
@Tarodev
@Tarodev Жыл бұрын
@@Astamor When editing your maps, how are you linking the lever and door together? Assuming you can have unlimited levers and doors scattered around the map.
@Astamor
@Astamor Жыл бұрын
@@Tarodev They are prefabs. Every door/lever has scriptable object conatining it's name, description and most importantly id number. The lever with id=5 will open door with id 6, lever id = 115 will open door with id 116 etc. I use unity events to do it. Super easy and you can later just swap scriptable object on a lever to change it's functionality.
@timotheefermeaux9183
@timotheefermeaux9183 2 жыл бұрын
Hey for the offset you could have done "(x + y) % 2 == 0"
@macjd4002
@macjd4002 Жыл бұрын
Like it very much
@iliketoast
@iliketoast 2 жыл бұрын
will it lag if i put too many lines of code in the tile prefab
@Tarodev
@Tarodev 2 жыл бұрын
As long as the code is efficient it will be perfectly fine. For example don't have heavy logic in their update loop
How to make a moving character in Unity
3:29
Tarodev
Рет қаралды 39 М.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 51 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 69 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 12 МЛН
Procedurally Generating A Hexagon Grid in Unity
11:29
Game Dev Guide
Рет қаралды 117 М.
10 Things You NEED to Be Doing in Unity
11:40
Tarodev
Рет қаралды 130 М.
Turn-Based Combat in Unity
29:40
Brackeys
Рет қаралды 573 М.
Learning C++ by making a Game... in 1 Week?!
10:14
Floky
Рет қаралды 434 М.
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 524 М.
Making a difficult game about fitting in - Acerola Jam 0
19:17
jess::codes
Рет қаралды 345 М.
I made a big Fire Elemental erupting from a Volcano
11:25
North of the Border
Рет қаралды 48 М.
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
10 Unity Tips You (Probably) Didn't Know About
8:58
Sasquatch B Studios
Рет қаралды 10 М.
I Built a Transparent Boomerang (it's lethal)
13:10
Mike Shake
Рет қаралды 4 МЛН
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 51 МЛН