Version: 2022.1
public Search.QueryFilterOperator AddOperator (string op);

参数

op The operator identifier.

返回

QueryFilterOperator The added, or existing, QueryFilterOperator.

描述

Add a custom filter operator specific to the filter.

Custom operators defined on a filter take precedence over operators defined globally on the QueryEngine. This is useful if you wish to have a custom operator only for a specific filter, or if you wish to override the default behavior of a built-in operator for a specific filter. If the operator already exists, the existing operator is returned.

// Override global operators with specific operator handlers for this filter
filter.AddOperator("=").AddHandler((Vector2 ev, Vector2 fv) => ev == fv);
filter.AddOperator("!=").AddHandler((Vector2 ev, Vector2 fv) => ev != fv);

See IQueryEngineFilter for a complete example.

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