# GenerateTexture

> Generates Texture2D and Sprite Assets based on the settings provided.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.AssetImporters](/engine/6000.6/script-reference/unityeditor/assetimporters.md)
* **Assembly:** UnityEditor.CoreModule

## GenerateTexture(TextureGenerationSettings, NativeArray\<Color32>)

Generates [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md) Assets based on the settings provided.

```csharp
public static TextureGenerationOutput GenerateTexture(TextureGenerationSettings settings, NativeArray<Color32> colorBuffer)
```

### Parameters

**** (\[TextureGenerationSettings]\(/engine/6000.6/script-reference/unityeditor/assetimporters/texturegenerationsettings)): Settings use for generating [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md).**** (\[NativeArray\<Color32>]\(/engine/6000.6/script-reference/unity/collections/nativearray1)): Color buffer for generating [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md).

### Returns

| Type                                                                                                             | Description               |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------- |
| [TextureGenerationOutput](/engine/6000.6/script-reference/unityeditor/assetimporters/texturegenerationoutput.md) | Result of the generation. |

### Remarks

As Unity may perform in-place processing of `colorBuffer`, it is recommended that you make a copy of its original data if you need it after this method returns.

## GenerateTexture(TextureGenerationSettings, NativeArray\<Color>)

Generates [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md) Assets based on the settings provided.

```csharp
public static TextureGenerationOutput GenerateTexture(TextureGenerationSettings settings, NativeArray<Color> colorBuffer)
```

### Parameters

**** (\[TextureGenerationSettings]\(/engine/6000.6/script-reference/unityeditor/assetimporters/texturegenerationsettings)): Settings use for generating [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md).**** (\[NativeArray\<Color>]\(/engine/6000.6/script-reference/unity/collections/nativearray1)): Color buffer for generating [Texture2D](/engine/6000.6/script-reference/unityengine/texture2d.md) and [Sprite](/engine/6000.6/script-reference/unityengine/sprite.md).

### Returns

| Type                                                                                                             | Description               |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------- |
| [TextureGenerationOutput](/engine/6000.6/script-reference/unityeditor/assetimporters/texturegenerationoutput.md) | Result of the generation. |

### Remarks

As Unity may perform in-place processing of `colorBuffer`, it is recommended that you make a copy of its original data if you need it after this method returns.
