I’m trying to automate the process of updating a unity project with a package. From a bash script, I run:
which updates the package as expected. The variables above are just directory paths as you might imagine.
However when I try to run the same command with the -batchmode flag, the package does not get imported. There isn’t anything amiss in the editor logs, and I’ve tried with Unity 5.1 and 5.3.4. It is as if Unity quits before it actually gets to import the files but it’s imported the package. Or is that the way it is designed?
Bumping this as we are seeing this too in 2017.2.1p2 Editor. Essentially, we call into AssetDatabase.ImportPackage during a command line method execution on Unity. The console reports that it is displaying a progress bar for importing the package however it is never imported.
From another thread, we’ve learned that ImportPackage is non-blocking; therefore, we’ve tried a while loop that checks for the imported asset else Thread.sleeps. The problem here, is that it blocks the main thread which then must prevent the package from importing.
I’m still seeing this issue in 2018.1.9f2. Did Unity ever comment? This seems pretty egregious. If you’re importing packages, you’re obviously doing it because you reference those packages in your code. So why would it check for errors BEFORE importing?
I’m gonna bump this up because I am still seeing the same issue in 2019.3. Anyone knows a workaround for this?
I am currently building a build pipeline that would greatly benefit from this
I am also having the same issue here (2019.4.13f1).
I am creating a pipeline to test a package in Azure DevOps for that i need to create a project from the command line, which runs fine. But I also need to import the package before running the unit tests.
Can we file a bug regarding the -importPackage switch.
I should also add that documentation does not specify if we should provide the relative or absolute path of the directory containing the package, the package.json file or the tarball archive.
Note in my case I was also using -executeMethod and the package was always imported after the call to the method. This didn’t work for me because I was calling a custom build pipeline which was dependent on the package being imported. To get around this on our build server I ran the above import command as a separate build step before using -executeMethod.