Search Unity

How to programmatically import a Package

Discussion in 'Editor & General Support' started by NachoFernandez, Oct 6, 2017.

  1. NachoFernandez

    NachoFernandez

    Joined:
    Oct 3, 2017
    Posts:
    3
    Hello!

    I am trying to automatically build a Unity app in Jenkins. Before being able to do that, I have to import a .unitypackage generated somewhere else. I am testing the steps on my machine, and when I run

    "C:\Program Files\Unity\Editor\Unity.exe" -batchmode -projectPath <projectFullPath> -logFile logfile.txt -importPackage <.unitypackage FullPath>

    the command seems to finish really fast, even though I can see in the task manager that the Unity executable is still running and doing things, and in fact the logfile.txt keeps being updated. At the end I can see that everything has been successfully imported.

    Now, if I try that on the build machine, it seems as though it tries to actually build the project even though I am not specifying that.

    And further down the same logfile:

    Those errors will be fixed if the import is successful, because that's basically what the import is for, to include scripts and assets to be able to build the app.

    Note, that I am running this command directly in a shell step in the Jenkins job and not as a "invoke unity3d" step, like this

    ${UNITY_HOME}Unity -importPackage ${ROOT_DIR}/${UNITYPACKAGE} -projectPath ${ROOT_DIR} -logFile ${ROOT_DIR}/logfile.txt -batchmode -quit

    I am running 5.6.1f on both machines. Any suggestions?
     
    Last edited: Oct 6, 2017
  2. NachoFernandez

    NachoFernandez

    Joined:
    Oct 3, 2017
    Posts:
    3
    I am still testing stuff, and If I select to run the importPackage step without batchmode, the Unity process seems to never finish, and the process is in sleeping state:

     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    did u ever find a solution for this ?
     
  4. DanielC2017

    DanielC2017

    Joined:
    Dec 5, 2017
    Posts:
    4
    Any updates on this?
     
  5. parismorgan

    parismorgan

    Joined:
    Sep 12, 2018
    Posts:
    1
    Has anyone found a solution for this?