今天分享一個(gè)在項(xiàng)目中為了便于配置添加到右鍵菜單的小功能。
目的:方便配置資源路徑操作方法:1.在Unity Editor內(nèi)右鍵點(diǎn)擊待操作的資源;2.再右鍵菜單內(nèi)單擊"Copy Asset Path to ClipBoard"
// 復(fù)制資源路徑到剪貼板 [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#if UNITY_EDITOR using UnityEditor;#endif
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注