# GetPreview(SearchContext, Vector2, FetchPreviewOptions, bool)

> Gets the search item preview if available, otherwise the preview is fetched at this time.

## Definition

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

```csharp
public Texture2D GetPreview(SearchContext context, Vector2 size, FetchPreviewOptions options = FetchPreviewOptions.Normal, bool cacheThumbnail = false)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.7/script-reference/unityeditor/search/searchcontext)): Search context used to fetch the preview.**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): Indicates the size of the desired preview.**** (\[FetchPreviewOptions]\(/engine/6000.7/script-reference/unityeditor/search/fetchpreviewoptions)): Indicates the options used to fetch various preview types.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Indicates if the preview thumbnail should be cached for next time.

### Returns

| Type                                                                  | Description                               |
| --------------------------------------------------------------------- | ----------------------------------------- |
| [Texture2D](/engine/6000.7/script-reference/unityengine/texture2d.md) | Returns the generated preview 2D texture. |
