Replaces that list of labels on an asset.
using UnityEngine; using UnityEditor;
public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/SetVegetationLabels")] 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"}); } } }
Did you find this page useful? Please give it a rating: