From the course: Unity 5: 2D Building a Tile Map Editor

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Tile picker with padding

Tile picker with padding

- [Voiceover] Now that we're using our new, optimized tiles, let's take a look at what happens in the tile picker. If we select the tile map, and give focus to our tile picker, then zoom in to five, you'll see as we click around, our selection tool is off. Also, it's starting to throw errors that we're getting an array out of index. This is because our tile map picker doesn't know about the new padding we added to the texture. Let's go ahead and clear this, and open up our scripts tile map class. Let's copy the line where we set up our tile size as a vector2, and paste it below. Here, we're gonna call this tilePadding. Next, we need a way to set the value of the tile padding, so let's go to our tile map editor, and where we display the tile size, let's create a new line, and we're gonna set the map.tilePadding equal to the EditorGUiLayout dot Vector2Field. We'll set a label of Tile Padding, and then for the default value, we'll set it back to the map tilePadding vector. Once we've…

Contents