Design a tree in the Tree Editor, create its materials, and add collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary.
If you want to use an imported meshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary, refer to Create trees and leaves from meshes.
To create a new Tree asset, from the main menu, select GameObject > 3D Object > Tree.
This action adds a tree to your SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary view. It also adds a tree prefabAn asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary (Tree.prefab
) and a texture folder (Tree_Textures
) in the Assets
folder of your Project window.
Trees can render correctly only when placed in a folder called Ambient-Occlusion
.
Assets
folder.Ambient-Occlusion
.Ambient-Occlusion
folder.The first branch functions as the trunk - it starts on the ground and grows upwards. This example creates a single trunk, but you can create multiple trunks, for example for a group of reeds (refer to the Frequency property in the Branch group reference).
Select the tree to view it in the Inspector window. The Tree Hierarchy view shows the root node and the branch group that functions as the trunk. To learn more, refer to Tree Editor concepts.
Use the Tree Hierarchy view controls to manage branch and leaf groups:
Branches are managed in groups. To add branches to the tree trunk, in the Tree Hierarchy view, select the existing branch group (the trunk) and click Add Branch Group.
A new branch group has only one branch. To add more branches, in the Inspector window > Tree Hierarchy view, select the new branch group and change its Frequency setting.
To add smaller branches to the existing branches, select the branch group you just added (not the trunk) and click Add Branch Group. The new branch group is added at a level above the selected branch group. Change the new group’s frequency to add more branches.
Note: The frequency isn’t always the final number of branches. The number of branches in the first group does equal its frequency, because those branches all grow out of a single branch (the trunk). In this new group, however, the branches grow from all the branches in the previous group, and so their frequency is distributed. To create a natural look, the growth isn’t uniform, meaning the distribution isn’t even. As a result, the final number of branches in the second group isn’t a simple product of the two frequencies.
A new branch group’s growth angle is parallel to the ground. To change the angle, select the branch group and adjust its Growth Angle setting. You can also change its Seek Sun setting to make the branches bend upwards or downwards.
For more branch group settings and to learn about fronds, refer to Branch group reference.
You can add leaves to any branch group, including the trunk. You can also add leaves to the tree root node, which gives the effect of leaves scattered on the ground. Like branches, leaves are managed in groups.
To add leaves to a branch group, select the branch group and click Add Leaf Group.
Leaves are added as an opaque plane. Change the group settings until you like the leaves’ appearance before adding materials. For more information, refer to Leaf group reference.
You can use the leaf group to add fruit. Refer to Create trees and leaves from meshes for more information.
To create fruit and leaves that overlap, add two leaf groups at the same level, and give them the same frequency and distribution.
Trees have four materials: for the leaves, the fronds, the bark, and the cross-section visible on broken branches.
To create a material:
From the main menu, select Assets > Create > Material.
Name the material.
Tree Editor trees and leaves must use these shaders. You can’t use your own shaders.
Add textures. If you don’t have textures yet, you can rely on the Main color selection for testing, or download assets from the Unity Asset Store.
To learn more about textures, refer to TexturesAn image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info
See in Glossary.
To add a material to a group, select the group in the Tree Hierarchy view and assign the material in its Geometry section:
GameObject transforms work only on the tree as a whole and are available when you select the tree root node.
To transform individual branches and leaves, use the tree creator’s control points.
Tip: To transform the entire tree, click the Tree Root Node button.
When you select a branch group in the Tree Hierarchy view, the Unity Editor selects its branches in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary. The branch or leaf group in the Scene view includes control points, which you can use to edit the branch or leaf. The following example shows a tree with a single branch selected.
The control options are available from a toolbarA row of buttons and basic controls at the top of the Unity Editor that allows you to interact with the Editor in various ways (e.g. scaling, translation). More info
See in Glossary below the Tree Hierarchy view.
The control points of the branches pass through the center line of each branch. You can click and drag any of the control points to move the branch.
For a branch, the control options are:
For leaves, the control options are:
Some branch and leaf properties are procedural, meaning that the Tree Editor generates them. When you edit a branch or leaf, the Tree Editor disables the procedural properties.
To restore the procedural properties, click Convert to Procedural Group. This removes any edits you made by hand.
Colliders define the shape of an object. They calculate physical collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary so that a character can’t walk through a tree, for example. Trees use the Capsule ColliderA capsule-shaped collider component that handles collisions for GameObjects like barrels and character limbs. More info
See in Glossary component.
To learn more about tree colliders, refer to Add collision to trees.
Wind Zones animate tree movements.
To add a Wind ZoneA GameObject that adds the effect of wind to your terrain. For instance, Trees within a wind zone will bend in a realistic animated fashion and the wind itself will move in pulses to create natural patterns of movement among the tree. More info
See in Glossary GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary, in the tree’s Inspector window, click Create Wind Zone. You can do this from any branch or leaf group, but not from the tree root node.
The Wind Zone’s default settings create a gentle breeze, and you can use it for your trees without changing it. If you want to create a stronger wind effect, refer to Animate trees with Wind Zones.
The tree is now ready to be painted onto the terrainThe landscape in your scene. A Terrain GameObject adds a large flat plane to your scene and you can use the Terrain’s Inspector window to create a detailed landscape. More info
See in Glossary in groups. It’s a good idea to make the tree GameObject invisible so that you don’t accidentally move it or change its settings.
Select the tree GameObject in the Hierarchy window, and in the Inspector window, disable the Visibility checkbox next to the GameObject’s name.
Use the Paint Trees tool to add clumps of your tree to the terrain. Refer to Add trees to the terrain for more information.