Version: 2020.1
言語: 日本語
public static string GUIDToAssetPath (string guid);

説明

Gets the corresponding asset path for the supplied guid, or an empty string if the GUID can't be found.

Returned paths are relative to the project folder, for example: "Assets/MyTextures/hello.png".

using UnityEditor;
using UnityEngine;

public class GUIDToAssetPathExample : MonoBehaviour { [MenuItem("APIExamples/GUIDToAssetPath")] static void MaterialPathsInProject() { var allMaterials = AssetDatabase.FindAssets("t: Material");

foreach (var guid in allMaterials) { var path = AssetDatabase.GUIDToAssetPath(guid); Debug.Log(path); } } }