Version: 2020.2
LanguageEnglish
  • C#

AssetDatabase.ClearLabels

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static void ClearLabels(Object obj);

Description

Removes all labels attached to an asset.

using UnityEngine;
using UnityEditor;
public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/Clear Labels")]
    static void ClearAssetLabels()
    {
        for (var i = 0; i < 10; i++)
        {
            var prefabPath = $"Assets/Prefabs/Litter/Litter{i}.prefab";
            var asset = AssetDatabase.LoadMainAssetAtPath(prefabPath);
            AssetDatabase.ClearLabels(asset);
        }
    }
}