Version: 2020.2
言語: 日本語
public static VersionControl.Asset GetAssetByGUID (string guid);

パラメーター

guid アセットの GUID

説明

Returns version control information about an asset from a given GUID.

Unity の Editor で GUID がわからない場合は null を返します。

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

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/GetAssetByGUID")] static void ExampleGetAssetByGUID() { string guid = AssetDatabase.AssetPathToGUID("Assets/ExampleAsset.mat"); AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByGUID(guid)); Debug.Log("Found an asset: " + assets[0].name.ToString()); } }