Skip to content

Instantly share code, notes, and snippets.

@HilariousCow
Last active November 22, 2016 15:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HilariousCow/d1c73ff3a4675b04f62395ab98bbce55 to your computer and use it in GitHub Desktop.
Save HilariousCow/d1c73ff3a4675b04f62395ab98bbce55 to your computer and use it in GitHub Desktop.
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