Provider.GetAssetListFromSelection

声明

public static VersionControl.AssetList GetAssetListFromSelection();

描述

返回当前选定资源的版本控制信息。

此方法实际上将所有当前选定的资源添加到一个 AssetList 中,该列表可用于进一步处理。

using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/GetAssetListFromSelection")] public static void ExampleGetAssetListFromSelection() { AssetList assets = Provider.GetAssetListFromSelection(); Debug.Log("Selected asset: " + assets[0].name.ToString()); } }

上面的代码将当前选定的资源添加到一个 AssetList 中,并将它的名称输出到控制台。


Did you find this page useful? Please give it a rating: