Version: 2022.2
public bool TryGetFilter (string token, out Search.IQueryEngineFilter filter);
public bool TryGetFilter (Regex token, out Search.IQueryEngineFilter filter);

参数

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

返回

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

描述

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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961