Объявление
public ObjectSelectorHandlerWithLabelsAttribute(params string[] labels);public ObjectSelectorHandlerWithLabelsAttribute(bool matchAll, params string[] labels);
Параметры
labels | Массив строк, представляющий различные метки для использования в качестве ограничений. |
matchAll | Этот параметр указывает, должны ли совпадать все метки или должна присутствовать только одна из них. |
Описание
Конструктор, используемый для объявления ObjectSelectorHandlerWithLabelsAttribute в поле.
Параметр labels представляет метки, используемые в качестве ограничений. Если имеется более одной метки, ресурс должен иметь все метки, чтобы селектор объектов мог его отобразить. Если вы установите для параметра "matchAll" значение false, чтобы отключить это, должна присутствовать только одна метка.
using System;
using UnityEngine;
using UnityEngine.SearchService;
public class GameObjectComponent : MonoBehaviour
{
// Declare a field that only supports textures with the "4K" label on it.
[ObjectSelectorHandlerWithLabels("4k")]
public Texture2D texture4KLabels;
// Declare a field that only supports textures with the "Funny" label on it.
[ObjectSelectorHandlerWithLabels("Funny")]
public Texture2D funnyTextureLabels;
// Declare a field that only supports textures with the "4K" and "Funny" labels on it.
[ObjectSelectorHandlerWithLabels("Funny", "4k")]
public Texture2D funny4KTextureLabels;
// Declare a field that supports textures with the "4K" or "Funny" labels on it.
[ObjectSelectorHandlerWithLabels(false, "Funny", "4k")]
public Texture2D funnyOr4KTextureLabels;
// Start is called before the first frame update.
void Start()
{
}
// Update is called once per frame.
void Update()
{
}
}