Version: 2023.2
LanguageEnglish
  • C#

QueryEngine<T0>.TryGetFilter

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool TryGetFilter(string token, out Search.IQueryEngineFilter filter);

Declaration

public bool TryGetFilter(Regex token, out Search.IQueryEngineFilter filter);

Parameters

token The token used to create the filter.
filter The existing IQueryEngineFilter, or null if it does not exist.

Returns

bool Returns true if the filter is retrieved or false if the filter does not exist.

Description

Get a filter by its token.

This method tries to retrieve a filter by its token. If it exists, it will be put in the output parameter "filter" and the function returns true. If the filter does not exist, the parameter "filter" is set to null and the function returns false.

// Get the filter corresponding to the token "id"
if (!queryEngine.TryGetFilter("id", out var idFilter))
    Debug.LogError("The filter \"id\" should have been found.");

See GetAllFilters for a complete example.