Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.IO;
using System.Text;
using UnityEditor;
using UnityEditor.Experimental;
using UnityEngine;
public class LibraryPathsForAsset
public static void OutputLibraryPathsForAsset()
var assetPath = "Assets/Shaders/Mat05.mat";
StringBuilder assetPathInfo = new StringBuilder();
var guidString = AssetDatabase.AssetPathToGUID(assetPath);
var hash = AssetDatabaseExperimental.GetArtifactHash(guidString);
AssetDatabaseExperimental.GetArtifactPaths(hash, out var paths);
assetPathInfo.Append($"Files associated with {assetPath}");
foreach (var curVirtualPath in paths)
//The virtual path redirects somewhere, so we get the
//actual path on disk (or on the in memory database, accordingly)
var curPath = Path.GetFullPath(curVirtualPath);
assetPathInfo.Append("\t" + curPath);
Debug.Log("Path info for all assets:\n"+assetPathInfo.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.