# CreateItem

> Helper function to create a new search item for the current search provider.

## Definition

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

## CreateItem(SearchContext, string, int, string, string, Texture2D, Object)

Helper function to create a new search item for the current search provider.

```csharp
public SearchItem CreateItem(SearchContext context, string id, int score, string label, string description, Texture2D thumbnail, object data)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.5/script-reference/unityeditor/search/searchcontext)): Search context from the query that generates this item.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Relevance score of the search item. The relevance score is used to sort all the results per search provider. Lower relevance scores indicate more relevance and are shown first.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Display name of the item. It is displayed on the first line of the search item UI widget. If there is no `label` given, the `id` parameter is used instead.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The search item description is displayed on the second line of the search item UI widget.**** (\[Texture2D]\(/engine/6000.5/script-reference/unityengine/texture2d)): The search item thumbnail is displayed to the left of the item label and description as a preview.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. [SearchProvider.fetchDescription](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchdescription.md)).

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(string, int, string, string, Texture2D, Object)

Helper function to create a new search item for the current search provider.

> **Warning:**
>
> **Deprecated.** Use CreateItem which take a SearchContext

```csharp
public SearchItem CreateItem(string id, int score, string label, string description, Texture2D thumbnail, object data)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Relevance score of the search item. The relevance score is used to sort all the results per search provider. Lower relevance scores indicate more relevance and are shown first.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Display name of the item. It is displayed on the first line of the search item UI widget. If there is no `label` given, the `id` parameter is used instead.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The search item description is displayed on the second line of the search item UI widget.**** (\[Texture2D]\(/engine/6000.5/script-reference/unityengine/texture2d)): The search item thumbnail is displayed to the left of the item label and description as a preview.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. [SearchProvider.fetchDescription](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchdescription.md)).

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(SearchContext, string)

Helper function to create a new search item for the current search provider.

```csharp
public SearchItem CreateItem(SearchContext context, string id)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.5/script-reference/unityeditor/search/searchcontext)): Search context from the query that generates this item.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(string)

Helper function to create a new search item for the current search provider.

> **Warning:**
>
> **Deprecated.** Use CreateItem which take a SearchContext

```csharp
public SearchItem CreateItem(string id)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(string, string)

Helper function to create a new search item for the current search provider.

> **Warning:**
>
> **Deprecated.** Use CreateItem which take a SearchContext

```csharp
public SearchItem CreateItem(string id, string label)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Display name of the item. It is displayed on the first line of the search item UI widget. If there is no `label` given, the `id` parameter is used instead.

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(string, string, string, Texture2D, Object)

Helper function to create a new search item for the current search provider.

```csharp
public SearchItem CreateItem(string id, string label, string description, Texture2D thumbnail, object data)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Display name of the item. It is displayed on the first line of the search item UI widget. If there is no `label` given, the `id` parameter is used instead.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The search item description is displayed on the second line of the search item UI widget.**** (\[Texture2D]\(/engine/6000.5/script-reference/unityengine/texture2d)): The search item thumbnail is displayed to the left of the item label and description as a preview.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. [SearchProvider.fetchDescription](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchdescription.md)).

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).

## CreateItem(SearchContext, string, string, string, Texture2D, Object)

Helper function to create a new search item for the current search provider.

```csharp
public SearchItem CreateItem(SearchContext context, string id, string label, string description, Texture2D thumbnail, object data)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.5/script-reference/unityeditor/search/searchcontext)): Search context from the query that generates this item.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Unique ID of the search item. This is used to remove duplicates in the user view.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Display name of the item. It is displayed on the first line of the search item UI widget. If there is no `label` given, the `id` parameter is used instead.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The search item description is displayed on the second line of the search item UI widget.**** (\[Texture2D]\(/engine/6000.5/script-reference/unityengine/texture2d)): The search item thumbnail is displayed to the left of the item label and description as a preview.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. [SearchProvider.fetchDescription](/engine/6000.5/script-reference/unityeditor/search/searchprovider/fetchdescription.md)).

### Returns

| Type                                                                           | Description                                                            |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md) | The newly created search item attached to the current search provider. |

### Remarks

For different use cases see [SearchProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider.md), [SearchProvider.id](/engine/6000.5/script-reference/unityeditor/search/searchprovider/id.md), [SearchProvider.isExplicitProvider](/engine/6000.5/script-reference/unityeditor/search/searchprovider/isexplicitprovider.md), [SearchProvider.priority](/engine/6000.5/script-reference/unityeditor/search/searchprovider/priority.md).
