Version: 2022.2
public void IndexProperty (int documentIndex, string name, string value, bool saveKeyword, bool exact);

参数

documentIndex Document where the indexed word was found.
name Key used to retrieve the value.
value Value to add to the index.
saveKeyword Define if we store this key in the keyword registry of the index.
exact If exact is true, only the exact match of the value will be stored in the index (not the variations).

描述

Adds a property value to the index. A property is specified with a key and a string value. The value will be stored with multiple variations.

The following example indexes a new boolean property named testismobilefriendly that will be used to search textures that match testismobilefriendly=true or testismobilefriendly=false.

[CustomObjectIndexer(typeof(Texture2D))]
static void IndexMobileFriendlyTexture(CustomObjectIndexerTarget target, ObjectIndexer indexer)
{
    var texture = target.target as Texture2D;
    if (texture == null)
        return;

    bool isMobileFriendly = texture.width < 64 && texture.height < 64;
    indexer.IndexProperty(target.documentIndex, "testismobilefriendly", isMobileFriendly.ToString(), true);
}

See SearchIndexer.AddProperty for more information and examples about indexing properties.

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