Skip to content

Instantly share code, notes, and snippets.

@robotron2084
Created March 1, 2016 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robotron2084/f604a8af46a80b07a027 to your computer and use it in GitHub Desktop.
Save robotron2084/f604a8af46a80b07a027 to your computer and use it in GitHub Desktop.
Copy Reference To Clipboard
using UnityEngine;
using UnityEditor;
public static class CopyRefUtil
{
[MenuItem ("Assets/Copy Ref To Clipboard %&c")]
public static void GetReferencesString()
{
string path = AssetDatabase.GetAssetPath(Selection.activeObject);
if(path.IndexOf("Resources") > -1)
{
path = path.Substring(path.LastIndexOf("Resources/") + 10);
path = path.Substring(0, path.LastIndexOf("."));
EditorGUIUtility.systemCopyBuffer = path;
}else{
Debug.LogError("[Copy Ref To Clipboard] Not an object in a resources folder.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment