# GetAssetPreviewFromPath

> Returns a preview texture to be used in the search view.

## Definition

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

## GetAssetPreviewFromPath(string, FetchPreviewOptions)

Returns a preview texture to be used in the search view.

```csharp
public static Texture2D GetAssetPreviewFromPath(string path, FetchPreviewOptions previewOptions)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Asset path.**** (\[FetchPreviewOptions]\(/engine/6000.5/script-reference/unityeditor/search/fetchpreviewoptions)): Additional preview options.

### Returns

| Type                                                                  | Description      |
| --------------------------------------------------------------------- | ---------------- |
| [Texture2D](/engine/6000.5/script-reference/unityengine/texture2d.md) | Preview texture. |

### Remarks

See [SearchProvider.fetchPreview](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchpreview.md).

## GetAssetPreviewFromPath(SearchContext, string, FetchPreviewOptions, Vector2)

Returns a preview texture to be used in the search view.

```csharp
public static Texture2D GetAssetPreviewFromPath(SearchContext context, string path, FetchPreviewOptions previewOptions, Vector2 previewSize = default)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.5/script-reference/unityeditor/search/searchcontext)): **** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Asset path.**** (\[FetchPreviewOptions]\(/engine/6000.5/script-reference/unityeditor/search/fetchpreviewoptions)): Additional preview options.**** (\[Vector2]\(/engine/6000.5/script-reference/unityengine/vector2)): Request size of the preview. This is useful for the [DisplayMode.Grid](/engine/6000.5/script-reference/unityeditor/search/displaymode/grid.md) view.

### Returns

| Type                                                                  | Description      |
| --------------------------------------------------------------------- | ---------------- |
| [Texture2D](/engine/6000.5/script-reference/unityengine/texture2d.md) | Preview texture. |

### Remarks

See [SearchProvider.fetchPreview](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchpreview.md).

## GetAssetPreviewFromPath(string, Vector2, FetchPreviewOptions)

Returns a preview texture to be used in the search view.

```csharp
public static Texture2D GetAssetPreviewFromPath(string path, Vector2 previewSize, FetchPreviewOptions previewOptions)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Asset path.**** (\[Vector2]\(/engine/6000.5/script-reference/unityengine/vector2)): Request size of the preview. This is useful for the [DisplayMode.Grid](/engine/6000.5/script-reference/unityeditor/search/displaymode/grid.md) view.**** (\[FetchPreviewOptions]\(/engine/6000.5/script-reference/unityeditor/search/fetchpreviewoptions)): Additional preview options.

### Returns

| Type                                                                  | Description      |
| --------------------------------------------------------------------- | ---------------- |
| [Texture2D](/engine/6000.5/script-reference/unityengine/texture2d.md) | Preview texture. |

### Remarks

See [SearchProvider.fetchPreview](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchpreview.md).
