Hey, sorry for the late response. I created a simple workaround by running the UnityEditor from the Cli via the -importPackage argument.
Obviously this is not optimal as this has to be done for every package that is imported.
No matter the way I write the import code (with EditorApplication.delaycall or not) it does not work. The Log is always the same
f.e.
foreach (var moduleName in testnames)
{
var targetPath = Path.Combine(workspacePath, moduleName);
Debug.Log($"Importing Module: {targetPath}");
if (File.Exists(targetPath))
{
EditorApplication.delayCall += () =>
{
AssetDatabase.ImportPackage(targetPath, false);
};
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
else
{
Debug.LogError($"Module not found at path: {targetPath}");
}
}
Always results in this editor log:
Importing Module: ${CensoredPathToWorkspace}\Packagename.unitypackage
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
${Censored}
${Censored}
(Filename: ${Censore}.cs Line: 30)
Asset Pipeline Refresh (id=bbff9875456b54e49936888be7e7ca88): Total: 0.048 seconds - Initiated by RefreshV2(NoUpdateAssetOptions)
Finished importing all packages.
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
${Censored}
${Censored}
(Filename: ${Censored}.cs Line: 49)
[Physics::Module] Cleanup current backned.
[Physics::Module] Id: 0xf2b8ea05
[Licensing::IpcConnector] License Notification channel disconnected successfully.
[Licensing::IpcConnector] License Client channel disconnected successfully.
AcceleratorClientConnectionCallback - disconnected - :0
Shut down.
Cleanup mono
abort_threads: Failed aborting id: 0000000000002164, mono_thread_manage will ignore it
abort_threads: Failed aborting id: 00000000000019F4, mono_thread_manage will ignore it
abort_threads: Failed aborting id: 0000000000002164, mono_thread_manage will ignore it
abort_threads: Failed aborting id: 00000000000019F4, mono_thread_manage will ignore it
debugger-agent: Unable to listen on 3424
Checking for leaked weakptr:
Found no leaked weakptrs.
[Package Manager] Server process was shutdown
Edit: This happens no matter what the unitypackage contains (whether it contains tons of scripts, a single script without any Function or just a material)