1. 程式人生 > >Unity3d編輯器中複製資源路徑到剪貼簿

Unity3d編輯器中複製資源路徑到剪貼簿

    // 複製資源路徑到剪貼簿
    [MenuItem("Assets/Copy Asset Path to ClipBoard")]
    static void CopyAssetPath2Clipboard()
    {
#if UNITY_EDITOR
        string path = AssetDatabase.GetAssetPath(Selection.activeInstanceID);
        TextEditor text2Editor = new TextEditor();
        text2Editor.text = path;
        text2Editor.OnFocus();
        text2Editor.Copy();
#endif
    }
記得包含UnityEditor