Creating 2D Levels with UniTile

Creating 2D Levels with UniTile

As we’re starting to create levels in Unity, we’re discovering that making 2D levels in a 3D environment is no walk in the park. Luckily, we’ve discovered UniTile, an easy to use yet powerful tile-based 2D map editor for Unity.

If you’re interested, you should definitely check out the UniTile demonstration video to glimpse some of its capabilities. UniTile allows us to “paint” levels into Unity, then immediately jump into them to test them out, decreasing our level building time by several hours.

If you’ve decided that UniTile is appropriate for your project, here are a few simple steps for setting up and getting started.

Installing UniTile

UniTile comes as a Unity package, so you can just import the package into any existing project. Once you’ve saved the package on your computer, open your Unity project, then go to Assets > Import Package and browse to find the UniTile package.

Creating Textures

Before setting up UniTile in a new scene, you’ll need a texture that holds the pieces you want to use in your level. I create my textures in Adobe Illustrator, then export them as PNGs.

Importing Textures

You can then import the texture into your project. To do this, right-click in the Project window and go to Import New Asset, then find your texture. After importing, I modify the following settings for my textures:

Filter Mode: Trilinear

Texture Type: Advanced

Generate Mip Maps: Disable

Creating Materials

After importing the texture, create a new material. To do this, right-click in the Project window and go to Create > Material. Drag your texture onto the material and adjust the material settings. For my materials, I set the shader to Particles/Alpha Blended.

Setting up UniTile

After importing the UniTile package and creating your texture and material, create a new scene in Unity. Then, find the UniTileManager prefab in the UniTile package and drag it into the Hierarchy.

Click on Add New Layer to create the layer on which you’ll make your level.

With the new layer selected, drag the material you made into the Material slot in the Inspector window. You should see your material underneath. Adjust the layer properties, then click Apply.

Linking Prefabs/Colliders

To link prefabs and colliders to the pieces in your level, double-click on a tile to bring up the TileEditorWindow. Modify the settings as needed.

To start creating your level, first click on the hand tool in the top left corner. With the layer selected, left-click to highlight the tiles you want to place in your level. Then, just place the tiles where you want in the Scene view.

After placing all your objects, click Create Objects to connect all the prefabs and colliders. Voila! You’re ready to jump in and play.

Test Level

Here’s a test level I threw together in just a few minutes:

With UniTile, our level design process has become a lot simpler, enabling us to more quickly build and test new levels. Hopefully you’ll enjoy UniTile as much as we are. Enjoy!