# GenerateSecondaryUVSet

> Compute a unique UV layout for a Mesh, and store it in Mesh.uv2.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## GenerateSecondaryUVSet(Mesh)

Compute a unique UV layout for a Mesh, and store it in [Mesh.uv2](/engine/6000.3/script-reference/unityengine/mesh/uv2.md).

```csharp
public static bool GenerateSecondaryUVSet(Mesh src)
```

### Parameters

**** (\[Mesh]\(/engine/6000.3/script-reference/unityengine/mesh)): The Mesh to update.

### Returns

| Type                                                          | Description                                                          |
| ------------------------------------------------------------- | -------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if the calculation succeeded. Otherwise, returns false. |

### Remarks

When you import a model asset, you can instruct Unity to compute a lightmap UV layout for it using ModelImporter-generateSecondaryUV or the [Model Import Settings Inspector](/engine/6000.3/manual/assets-and-media/asset-types/models/importing/class-fbximporter.md). This function allows you to do the same to procedurally generated meshes.

If this process requires multiple UV charts to flatten the the mesh, the mesh might contain more vertices than before. If the mesh uses 16-bit indices (see [Mesh.indexFormat](/engine/6000.3/script-reference/unityengine/mesh/indexformat.md)) and the process would result in more vertices than are possible to use with 16-bit indices, this function fails and returns `false`.

Additional Resources: [Mesh](/engine/6000.3/script-reference/unityengine/mesh.md) class, [ModelImporter](/engine/6000.3/script-reference/unityeditor/modelimporter.md) class, [Generating Lightmap UVs](/engine/6000.3/manual/lighting-overview/direct-and-indirect-lighting/lightmapping/lighting-gi-uvs/generating-lightmapping-uvs.md).

## GenerateSecondaryUVSet(Mesh, UnwrapParam)

Compute a unique UV layout for a Mesh, and store it in [Mesh.uv2](/engine/6000.3/script-reference/unityengine/mesh/uv2.md).

```csharp
public static bool GenerateSecondaryUVSet(Mesh src, UnwrapParam settings)
```

### Parameters

**** (\[Mesh]\(/engine/6000.3/script-reference/unityengine/mesh)): The Mesh to update.**** (\[UnwrapParam]\(/engine/6000.3/script-reference/unityeditor/unwrapparam)): Settings that configure the calculation.

### Returns

| Type                                                          | Description                                                          |
| ------------------------------------------------------------- | -------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if the calculation succeeded. Otherwise, returns false. |

### Remarks

When you import a model asset, you can instruct Unity to compute a lightmap UV layout for it using ModelImporter-generateSecondaryUV or the [Model Import Settings Inspector](/engine/6000.3/manual/assets-and-media/asset-types/models/importing/class-fbximporter.md). This function allows you to do the same to procedurally generated meshes.

If this process requires multiple UV charts to flatten the the mesh, the mesh might contain more vertices than before. If the mesh uses 16-bit indices (see [Mesh.indexFormat](/engine/6000.3/script-reference/unityengine/mesh/indexformat.md)) and the process would result in more vertices than are possible to use with 16-bit indices, this function fails and returns `false`.

Additional Resources: [Mesh](/engine/6000.3/script-reference/unityengine/mesh.md) class, [ModelImporter](/engine/6000.3/script-reference/unityeditor/modelimporter.md) class, [Generating Lightmap UVs](/engine/6000.3/manual/lighting-overview/direct-and-indirect-lighting/lightmapping/lighting-gi-uvs/generating-lightmapping-uvs.md).
