Version: 2022.2
Language : English
Meshes
Mesh data

Meshes introduction

A mesh is a collection of data that describes a shape. In Unity, you use meshes in the following ways:

  • In graphics, you use meshes together with materialsAn asset that defines how a surface should be rendered. More info
    See in Glossary
    ; meshes describe the shape of an object that the GPU renders, and materials describe the appearance of its surface.
  • In physics, you can use a mesh to determine the shape of a colliderAn 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
    .

Deformable meshes

In addition to regular meshes, Unity also supports deformable meshes.

Deformable meshes fall into the following categories:

  • Skinned meshes: These meshes work with additional data called bones. Bones form a structure called a skeleton (also called a rig, or joint hierarchy), and the skinned mesh contains data that allows it to deform in a realistic way when the skeleton moves. You usually use skinned meshes for skeletal animation with Unity’s Animation features, but you can also use them with Rigidbody components to create “ragdoll” effects.
  • Meshes with blend shapes: These meshes contain data called blend shapes. Blend shapes describe versions of the mesh that are deformed into different shapes, which Unity interpolates between. You use blend shapes for morph target animation, which is a common technique for facial animation.
  • Meshes that work with a Cloth component component for realistic fabric simulation.

Creating meshes

You can add meshes to a Unity project in the following ways:

  • Create a mesh as part of a modelA 3D model representation of an object, such as a character, a building, or a piece of furniture. More info
    See in Glossary
    in a 3D modeling program, then import it. Unity creates a mesh asset as a part of the model hierarchy when you import a model. For more information, see Importing Models.
  • Create a mesh directly with in-Editor tools. Unity has built-in primitive shapes such as spheres and capsules that you can place directly into a 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
    . You can also use a package like ProBuilder to model a custom mesh in the Editor.
  • Create meshes with code, either at runtime or in the Editor.

Working with meshes

Unity stores meshes in your project as mesh assets, and represents them in C# code with the 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
class.

Depending on how you use meshes, they work with different components:

  • In graphics, Unity renders regular meshes with Mesh RendererA mesh component that takes the geometry from the Mesh Filter and renders it at the position defined by the object’s Transform component. More info
    See in Glossary
    components, and deformable meshes with Skinned Mesh Renderer components.
  • In physics, Unity uses the Mesh ColliderA free-form collider component which accepts a mesh reference to define its collision surface shape. More info
    See in Glossary
    component to determine the shape of a collider.

For detailed information about the data that a mesh contains and how Unity represents that data, see Mesh data.

Meshes
Mesh data