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.

Cleaning up the tile map

Cleaning up the tile map

- So at this point our TileMapEditor is done. The one thing we haven't tested though, is what happens if we create a new Tile Map. Let's Delete this one from our project and start over again. From the GameObject menu we'll select our Tile Map option, select it in the Hierarchy, and set the dorm-tiles as its Texture2D. Unfortunately, nothing happens and that's because we have a little bit of a bug. Let's go into the Console and take a look at what's happening. You'll see some warnings and some errors but the main one we want to focus on is this error here that has a NullReference inside of our Tile Map. If we double click on it we can take a look at what's happening. We're taken to line 16 of our Tile Map. And it looks like we're trying to access the currentTileBrush but the Sprite references aren't set yet. We can fix this in the TileMapEditor. Let's go into our OnInspectorGUI method where we set the Maps Texture2D from the object field. We have a similar problem that we had with the…

Contents