Gameplay / System Programmer

Terrain Tree to Prefab Converter

Unity Tool

Originally created in Unity during the development of a game and later refined through a tools development course, this editor tool converts painted Terrain trees into gameplay-ready prefabs inside a defined playable area, speeding up worldbuilding while keeping the surrounding environment lightweight and performant.

Role: Tool Programmer

Team Size: 1

1 weeks

Unity (C#)

Overview

Originally created during the development of a Unity game and later refined through a tools programming course, this project was built to solve a practical production problem. Terrain painting is one of the fastest ways to build natural environments in Unity, but Terrain trees are stored as lightweight instances rather than standard GameObjects, which makes them less useful in areas that require gameplay interaction.

To address this, I developed a Unity EditorWindow tool that converts painted Terrain tree instances inside a selected playable area into real prefab GameObjects, while leaving the rest of the environment as efficient Terrain data. This makes it possible to keep the speed of Terrain-based worldbuilding while turning key gameplay spaces into interactive and production-ready areas.

The result is a workflow that better connects worldbuilding, level design, and technical implementation. Instead of manually replacing painted trees one by one, the tool allows designers to define the gameplay zone once and convert only the trees that matter, improving both efficiency and performance awareness in the pipeline.

Problem

Unity’s Terrain tree system is excellent for quickly populating large outdoor scenes, but it comes with an important limitation: those trees are not normal scene GameObjects. Because of that, they are much harder to use for features such as colliders, scripts, destructible objects, navmesh obstacles, or other forms of gameplay interaction.

In a real production workflow, this creates a clear gap. Artists and level designers can paint vegetation very quickly, but once those areas need to support gameplay, the team may end up manually replacing large numbers of trees with prefabs. That process is repetitive, slow, and error-prone, especially when working in larger environments.

Solution

The solution was to create a custom Unity editor tool that automates this conversion step. The tool reads the Terrain’s existing treeInstances, checks which ones are inside a user-defined BoxCollider playable area, and converts only those matching trees into real prefab instances. Trees outside that area remain as Terrain instances, preserving the lightweight rendering benefits of the original Terrain workflow.

This selective conversion approach makes the tool practical for production. It supports the common need to keep distant vegetation efficient while making gameplay-critical spaces interactive, editable, and ready for systems such as collision, scripting, and physics. 

My Contribution

I designed and implemented the full editor workflow for this tool, from the Editor Window interface to the underlying tree-to-prefab conversion logic. I also structured the workflow around usability, making sure that the tool was not just functional, but also clear and safe to use inside the Unity Editor.

A large part of the refinement focused on user experience. I added tooltips, in-window guidance, validation dialogs, and a ready / not ready status system so the user can immediately understand whether the tool is correctly configured before running the conversion. This made the tool feel more reliable and production-friendly rather than just a technical prototype.

Technical Breakdown

At its core, the tool works by reading the Terrain’s treeInstances, converting each tree’s normalized position into world space, and testing whether that position falls inside the selected BoxCollider. When a tree is inside the playable area and has a valid mapped prefab, the tool spawns a new prefab instance, applies rotation, optional terrain-normal alignment, scale, layer assignment, and parenting, then removes the converted tree from the Terrain data.

The tool also includes a validation layer before conversion begins. It checks for missing Terrain, missing TerrainData, disabled or missing BoxCollider, missing Tree Prototypes, and incomplete prefab mappings, then communicates those issues through dialog boxes and visual editor feedback. This helps reduce user error and makes the workflow much easier to understand at a glance.

From a design perspective, the project also acknowledges technical tradeoffs. Converted trees become real GameObjects, which are heavier than Terrain instancing, so the tool is intentionally built around converting only the playable area instead of the full environment. That makes it a targeted production tool rather than a blanket replacement system

Repository:

Code: