Search Unity

Feedback SOLUTION: Copy Full Folder Path Location option in Projects drop-down menu

Discussion in 'Editor & General Support' started by AlanMattano, Sep 5, 2019.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    In the Project window, if I right-click a menu pops up: I wish an option to "Copy Full Path Location" below Show in Explorer. So that is not necessary to open explorer to get the path location of the existing folder.
     
    Last edited: Aug 4, 2020
    HenryTownshend likes this.
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Often using external 3D applications or making Textures, I need to export out into a specific Project folder. So the folder location is needed to past it into instead of navigating, I wish just to compy the path.

    Here it is a final example for Windows
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using Object = UnityEngine.Object;
    4.  
    5. /****************************************
    6. *
    7. *       2020 Alan Mattano
    8. *       SOARING STARS Lab
    9. *
    10. * ***************************************/
    11.  
    12. public class Copy_Path : MonoBehaviour
    13. {
    14.     [MenuItem("Assets/Copy Full Path Location", false, 19)]
    15.     private static void CopyPathToClipboard()
    16.     {
    17.         Object obj = Selection.activeObject;
    18.         if (obj != null)
    19.         {
    20.  
    21.             if (AssetDatabase.Contains(obj))
    22.             {
    23.                 string path = AssetDatabase.GetAssetPath(obj);
    24.  
    25.                 path = path.TrimStart('A', 's', 's', 'e', 't');
    26.  
    27.                 path = Application.dataPath + path;
    28.  
    29.                 path = path.Replace('/', '\\');
    30.  
    31.                 GUIUtility.systemCopyBuffer = path;
    32.  
    33.                 Debug.Log("The full path was copy to the clipboard:\n" + path);
    34.             }
    35.         }
    36.     }
    37. }
    38.  

    Untitled-1.jpg
     
    Last edited: Aug 4, 2020
    HenryTownshend and gamezuv like this.