Version: Unity 6.3 LTS (6000.3)
Language : English
Cut out sprites from a texture
Create collision shapes for a sprite

Crop a sprite

Unity renders a spriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary
on a 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
. To crop the mesh to a different shape, use the Custom Outline tab of the Sprite Editor window.

You can use the Custom Outline tab to do the following:

  • Remove transparent pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
    See in Glossary
    from the mesh, to improve performance by reducing the number of unneeded pixels Unity renders.
  • Crop a sprite to a custom shape.

Open the Custom Outline tab of the Sprite Editor

Follow these steps:

  1. In the Hierarchy window, select the sprite 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
    .
  2. In the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    window, in the Sprite RendererA component that lets you display images as Sprites for use in both 2D and 3D scenes. More info
    See in Glossary
    component, select Open Sprite Editor.
  3. Select the Custom Outline tab in the top-left dropdown. Unity displays the Outline Tools overlay.

Remove transparent pixels from the mesh

Follow these steps in the Custom Outline tab:

  1. Select Generate to automatically generate a mesh that follows the opaque parts of the sprite. Unity displays the outline of the mesh in white. Each point is a vertex of the mesh.
  2. Edit the outline if needed. For more information, refer to the Edit an outline section.
  3. To save the shape, select Apply in the 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
    . Unity now renders only the area within the outline.

To change how closely the outline follows the opaque parts of the sprite. adjust the Outline Detail and Alpha Tolerance properties, then regenerate the mesh.

For more information, refer to Custom Outline tab reference for the Sprite Editor window.

Left: An automatically generated mesh outline with a low Outline Detail value. Right: An automatically generated mesh outline with a higher Outline Detail value.
Left: An automatically generated mesh outline with a low Outline Detail value. Right: An automatically generated mesh outline with a higher Outline Detail value.

Crop a sprite to a custom shape

Do the following in the Custom Outline tab:

  1. To create an outline, click and drag a rectangle. You can also follow the steps in the previous section to generate an outline.

    You can add multiple outlines to the same sprite.

  2. Edit the outline. For more information, refer to the Edit an outline section.

  3. To save the shape, select Apply in the toolbar. Unity now renders only the area within the outline.

Edit an outline

To edit an outline, do the following:

  • To move a point, select and drag it.
  • To add a point, click on an edge.
  • To delete a point, select it and press Delete.
  • To move an edge, hold Ctrl and select and drag the edge.

To save the new outline, select Apply in the toolbar.

Additional resources

Cut out sprites from a texture
Create collision shapes for a sprite