From the course: Unity 5: 2D Level Design

Unlock the full course today

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

Add layers

Add layers - Unity Tutorial

From the course: Unity 5: 2D Level Design

Start my 1-month free trial

Add layers

- [Instructor] Now before we can start building our first layer, we're going to need to make one more modification to our Tile Map Editor. We're going to need to set a custom layer to each of the tiles we draw, this way, the aliens know when they're standing on solid ground. To get started, let's open up our TileMapEditor. First, let's import a new collection of classes. We'll type out using System.Collections.Generic; this will give us access to the list collection class, which has some advantages over the array. The biggest one being that you can dynamically change the size of the list based on what you put inside of it. Next, we're going to need to keep track of the name of the layer we want to assign to the tile. So let's create a string field, and call it layerName, we'll also set this to an empty string. Unfortunately, there isn't an easy way for us to get the layer names that we've created in our project. So, we're going to have to iterate through all the custom names and build…

Contents