Version: 2022.1
言語: 日本語
public static void SetLabels (Object obj, string[] labels);

説明

アセットのラベルのリストを置き換えます。

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"}); } } }