assetPath
The path name of the asset for this importer. (Read Only)
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Property
- Namespace: UnityEditor
- Assembly: UnityEditor
public string assetPath { get; }
Examples
using UnityEngine;using UnityEditor;public class AssetPathExample : MonoBehaviour{ [MenuItem("Tools/AssetPathExample")] static void Example() { var importers = AndroidAssetPackImporter.GetAllImporters(); foreach (var importer in importers) { var labels = new string[0]; //Get asset path var path = importer.assetPath; //Use asset path to set labels if path contains "Icon" if (path.Contains("Icon")) { labels = new [] { "Icon" }; AssetDatabase.SetLabels(AssetDatabase.LoadAssetAtPath<Object>(path), labels); } } }}