Join Jesse Freeman for an in-depth discussion in this video Drawing a tile grid, part of Unity 5: 2D Building a Tile Map Editor.
- Now we're ready to draw the grid inside of our tile map.…Let's go back into our TileMap class.…Above where we start drawing out the border,…we're going to want to put the rendering logic…for each of the cells of the grid.…The reason we do this is that we want the grid to draw first…and then the border around it.…When you draw a Gizmos, it's very important…to make sure that the order goes from lowest to highest…as you lay it out inside of the OnDrawGizmosSelected method.…In order to help see the cells of the grid a little easier,…we're going to make them gray.…
Then we're going to need to create a few variables…to help us as we iterate through all the grid cells,…in order to render them out correctly.…We'll start by creating a row variable…and we'll set that to zero.…Now, we need to create a maxColumns variable,…and we'll set that to the mapSize.x.…Next, we'll calculate the total number of cells in the grid,…by multiplying the mapSize.x, by the mapSize.y.…Now, we'll need to get the size…of the tile and the World Space.…
Author
Updated
7/29/2016Released
12/7/2015- Adding custom dropdown menus to Unity
- Building a custom inspector
- Creating a texture picker
- Drawing the tile map grid
- Creating a tile picker
- Scaling a Texture2D
- Creating a tile brush
- Moving the tile brush
- Erasing and clearing tiles
Skill Level Intermediate
Duration
Views
Related Courses
-
Unity: Scripting with C#
with Kelley Hecker1h 19m Intermediate -
Unity 5: 2D Essential Training (2015)
with Jesse Freeman3h 22m Intermediate
-
Introduction
-
Welcome40s
-
Exercise files56s
-
-
1. Extending Unity's IDE
-
Setting up the project2m 16s
-
-
2. Building a Custom Inspector
-
3. Reading Sprites from a Texture
-
Showing a warning message2m 15s
-
Calculating tile size3m 1s
-
Calculating the map size2m 40s
-
Dynamic pixels to units2m 33s
-
4. Drawing the Tile Map Grid
-
Drawing a tile grid3m 23s
-
Updating the grid size2m 12s
-
5. Creating a Tile Picker
-
Creating a custom window2m 5s
-
Scaling the Texture2D2m 49s
-
Moving the highlight2m 17s
-
Saving the title selection2m 18s
-
-
6. Creating a Tile Brush
-
Create the tile brush1m 52s
-
-
7. Moving the Brush
-
Getting the mouse position2m 30s
-
Moving the tile brush4m 11s
-
-
8. Finishing Up the Tile Map
-
Erasing tiles1m 43s
-
Clearing all of the tiles2m 58s
-
Cleaning up the tile map5m 40s
-
9. Cleaning Up the Tile Picker
-
Optimizing a Texture2D7m 21s
-
Tile picker with padding3m 18s
-
-
Conclusion
-
Next steps1m 3s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Drawing a tile grid