CreateItem
Helper function to create a new search item for the current search provider.
Read time 5 minutesLast updated 11 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
CreateItem(SearchContext, string, int, string, string, Texture2D, Object)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(SearchContext context, string id, int score, string label, string description, Texture2D thumbnail, object data)
Parameters
Search context from the query that generates this item.
Unique ID of the search item. This is used to remove duplicates in the user view.
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.
Display name of the item. It is displayed on the first line of the search item UI widget. If there is no given, the parameter is used instead.
labelidThe search item description is displayed on the second line of the search item UI widget.
The search item thumbnail is displayed to the left of the item label and description as a preview.
Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. SearchProvider.fetchDescription).
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(string, int, string, string, Texture2D, Object)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(string id, int score, string label, string description, Texture2D thumbnail, object data)
Parameters
Unique ID of the search item. This is used to remove duplicates in the user view.
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.
Display name of the item. It is displayed on the first line of the search item UI widget. If there is no given, the parameter is used instead.
labelidThe search item description is displayed on the second line of the search item UI widget.
The search item thumbnail is displayed to the left of the item label and description as a preview.
Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. SearchProvider.fetchDescription).
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(SearchContext, string)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(SearchContext context, string id)
Parameters
Search context from the query that generates this item.
Unique ID of the search item. This is used to remove duplicates in the user view.
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(string)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(string id)
Parameters
Unique ID of the search item. This is used to remove duplicates in the user view.
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(string, string)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(string id, string label)
Parameters
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(string, string, string, Texture2D, Object)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(string id, string label, string description, Texture2D thumbnail, object data)
Parameters
Unique ID of the search item. This is used to remove duplicates in the user view.
Display name of the item. It is displayed on the first line of the search item UI widget. If there is no given, the parameter is used instead.
labelidThe search item description is displayed on the second line of the search item UI widget.
The search item thumbnail is displayed to the left of the item label and description as a preview.
Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. SearchProvider.fetchDescription).
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.
CreateItem(SearchContext, string, string, string, Texture2D, Object)
Helper function to create a new search item for the current search provider.
public SearchItem CreateItem(SearchContext context, string id, string label, string description, Texture2D thumbnail, object data)
Parameters
Search context from the query that generates this item.
Unique ID of the search item. This is used to remove duplicates in the user view.
Display name of the item. It is displayed on the first line of the search item UI widget. If there is no given, the parameter is used instead.
labelidThe search item description is displayed on the second line of the search item UI widget.
The search item thumbnail is displayed to the left of the item label and description as a preview.
Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. SearchProvider.fetchDescription).
Returns
Type | Description |
|---|---|
| SearchItem | The newly created search item attached to the current search provider. |
Remarks
For different use cases see SearchProvider, SearchProvider.id, SearchProvider.isExplicitProvider, SearchProvider.priority.