From the course: Unity 5: 2D Level Design

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add collisions

Add collisions - Unity Tutorial

From the course: Unity 5: 2D Level Design

Start my 1-month free trial

Add collisions

- [Instructor] Now it's time for us to customize our tile map editor. A big part of level design is building the tools you need in order to be able to lay out the level. We're going to go ahead and modify the existing tile map editor, to add in support for adding box colliders to each of the tiles we paint. Let's go ahead and search for the right class we'll need. Simply type in TileMapEditor, and select the TileMapEditor C# script by double-clicking on it. This is going to open up MonoDevelop for us. This class manages the custom editor we see inside of Unity when we're working with TileMapEditor. We're going to add a checkbox so that we can tell whether a tile is solid or not when we go to paint it. First, we're going to need to add a field to store this value. We're going to make this private and set it as a boolean, and call it solidFlag. By default, this is going to be set to false. Now let's scroll down and take a look at where we set the Pixels to Units value. Underneath this…

Contents