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.

Create the tile brush

Create the tile brush

- So now we're ready to start creating the actual brush instance we'll use to display inside of our scene. In order to do this, let's create a new C# script inside of our scripts folder called TileBrush. Then, we'll open this up inside of MonoDevelop. Our tile brush is going to need a few properties. First, we're going to want to keep track of a Vector2 that'll represent the brush's size. Let's set this to a vector zero. Next, we'll need to set an int to represent the tileID. And finally, we'll need a reference to the renderer we'll be using to display the sprite. Next, we can delete the start and update methods since we won't be using them. Now we're going to want to draw a gizmo that'll represent the border of the actual brush. Let's create a private method called OnDrawGizmosSelected. And inside of this we're going to set the gizmos color to red. Next, we're going to want to draw a wire cube that'll represent the border of our brush. Here we'll call the gismos classes DrawWireCube…

Contents