Created
March 1, 2016 22:11
-
-
Save robotron2084/f604a8af46a80b07a027 to your computer and use it in GitHub Desktop.
Copy Reference To Clipboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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