Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unity3d utility thing. Right Click an asset-> Copy Asset Path. - ideal for use with AssetDatabase.LoadAssetAtPath<>
using UnityEngine;
using UnityEditor;
public static class CopyAssetPathContextMenu
{
[MenuItem("Assets/Copy Asset Path")]
public static void CopyAssetPath()
{
if (Selection.activeObject != null)
{
string assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);
EditorGUIUtility.systemCopyBuffer = assetPath;
Debug.Log("Copied to Buffer:" + assetPath);
}
else
{
Debug.Log("Nothing selected.");
}
}
}
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.