Version: 2020.3
public static void SetLabels (Object obj, string[] labels);

설명

Replaces that list of labels on an asset.

using UnityEngine;
using UnityEditor;

public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Set Vegetation Labels")] static void SetVegetationAssetLabels() { //Search the Assets folder for all assets with "tree" in its name and then add "Vegetation" Label to every asset that we find foreach (var guid in AssetDatabase.FindAssets("tree", new [] {"Assets"})) { var path = AssetDatabase.GUIDToAssetPath(guid); var asset = AssetDatabase.LoadMainAssetAtPath(path); AssetDatabase.SetLabels(asset, new []{"Vegetation"}); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961