C# Import local package from menu
I'm attempting to do a simple import from a local path. Not sure where I'm messing up here. I'm not the strongest coder, so any insight is appreciated. Below is my attempt.
         [MenuItem("ImportMenu/ImportAsset")]
         static void ImportAssetOnlyImportsSingleAsset()
         {
             // My asset package file name
             string fileName = "MyAsset.unitypackage";
     
             // Project Asset folder path to save file to
             var assetsPath = Application.dataPath + "/" + fileName;
             Debug.Log($"Application.dataPath: {Application.dataPath}");
     
             // Where my asset package is located
             var filePath = "D:/Local_Projects/Packages/MyAsset";
             // Import asset
             AssetDatabase.ImportAsset(filePath);
     
             //Debug.Log("Imported: " + importedAssets);
         }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Google AdMob -unable to close Ad 0 Answers
c-sharp class can not reference Animation rigging package types 2 Answers
Unity "Type or namespace could not be found" with external NuGet package, no error in Visual Studios 0 Answers
Error With Cinemachine Path and Dolly 0 Answers
Getter and Setter Question! 1 Answer