Unity Level Design Tools

I’ve talked before about working on a prototype in Unity and now we’re finally getting back at working on it, I can’t give much details right now, but I only wanted to show some of the tools I’ve been developing for it.

The main purpose of these tools are to improve Unity as a level builder/editor. We first tried building the levels in 3dsmax and importing them to Unity, but things felt limited and too much work whenever something had to be changed. Maybe we could have worked around it but it was decided we needed to build the levels in Unity using 3D assets made in 3dsmax.

Placing Floors and Walls

The first tools is to help the placing of floor and walls, inspired by some games with in-game editors the floor is placed by “painting” (clicking and dragging) and the floor is placed snapping to a chosen grid size and grouped after is done.

The walls work in a similar way but they lock to an initial axis according to its rotation. And the types of wall (for windows or doors) can be changed on the fly.

Combining Meshes

The levels are then built of many parts and because of some features we aren’t going to use static batching from Unity, so for optimization we need to combine the meshes from the same room, that aren’t interactable and that share the same material. This tool then groups objects, combine the objects that share the same material (it creates one combined mesh for each material) and generates UVs for lightmapping. It also allows an easy way to undo the operation so we can make any changes to the objects.

Vertex Painting

Another step on creating the levels in Unity was the ability to make things look less repetitive using vertex colours. So I started using this free vertex painter for Unity then heavily modified it to best fit our needs. Our main shader takes two textures (a clean and a dirty version) which are mixed by the vertex alpha channel using a third small noise texture to blend them. It also adds any vertex colour on top of the textures.

These are for example the textures used in this level.

Adding Props

This tools is very similar to the one that places floors and walls, but now it take a list of different prefabs and then they can be easily placed in the level, taking into account other objects’ meshes or not, snapping to the grid, random rotation and scale which then can be easily modified on the fly.

Changing UV Layout

Since most of these simple objects have to share the same material we made texture atlases for them and I put together a tool to visually move the UV coordinates of a mesh, so no need for separate meshes or textures.

Final Touches

For the final touches I made two more¬†editor tools, the first is to bake Ambient Occlusion to the meshes’ vertex colours to add a bit more of depth.

We’re using baked lightmaps and light probes for the dynamic objects, so this last tools is to place the light probes through the level. Currently you have to place the probes by hand so this tools space the probes around the level, placing them only where there is floor and avoiding objects (otherwise the probe gets black and produces some unwanted effects).

The Result

Here’s the result of the level produced in this video:

and another type of level using the same tools:

Leave a Reply