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

preview_player
Показать описание
Create a grid in Unity of any width and height. I'll show you how to create a checkerboard pattern to better distinguish each tile as well as how to hover and select each individual tile.

Perfect for any tactics or turn-based game.

=========

=========



0:00 What we'll make
0:10 Creating the GridManager script
1:00 Creating the Tile prefab
1:30 Spawning the tiles
2:25 Centering the camera on the game map
3:30 Creating a checkboard pattern
5:35 Add hover and click events
7:07 Storing and getting the tiles via script
Рекомендации по теме
Комментарии
Автор

NOTICE: If you're having trouble seeing your tiles, ensure your sprite renderers alpha are set to 255. Sometimes it defaults to 0.

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!

Tarodev
Автор

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

jikosauce
Автор

For the offset bool you could use:
(x + y) % 2 == 1

theroboman
Автор

All that in under 9 minutes!
Tutorials are on par with the best on YT.
Thanks.

jameslavery
Автор

Instead of casting _width and _height to floats, you can divide them by 2f, it will result in a float.

larryd
Автор

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.

glebozhgikhin
Автор

Few minutes into the video and I already knew that this is an instant like and a sub

ksalarang
Автор

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.

nyx
Автор

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.

Umbra
Автор

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 :')

nyaenya
Автор

I looked for any sort of video tutorial, blog post, etc explaining this in 2020. Thank you so much!

squabbler_
Автор

Imagine not liking this video...
perfect video!
Short, clear, easy to follow.
Keep going!

paulglosemeyer
Автор

The Cameraposition based on the size of your grid was what I needed!

lln
Автор

Thanks for the tutorial, was very cleary and for non english speacker it was very simply to understand you without subtitles.

MarcosacroM
Автор

The visual studio text is too small, pretty difficult to read. Other than that pretty good tutorial.

kitteninamitten
Автор

This is a magnificent tutorial, thanks champ!

VikkersOlfsson
Автор

Absolutely brilliant tutorial, thank you very much for your work!

CharlieVanders
Автор

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.

zoop
Автор

Would look forward to more board game type of videos!

Shokukumi
Автор

Very nice video: clear, informative and easy to understand. Thank you!

jirikropocev