Search Unity

Deploying Packages through command line?

Discussion in 'Package Manager' started by darenkilley, Jun 5, 2019.

  1. darenkilley

    darenkilley

    Joined:
    Jun 5, 2019
    Posts:
    2
    Hello,

    To be honest I am not even sure this is the best area to post this but seemed relevant so I thought I would see if anyone here could help. To keep it short I work for a school that has a 'gaming development' class in which they use Unity. I have received a request from that Teacher asking if a package specifically..

    moon-lander-package.unitypackage

    Could be added to the entire lab's Unity installation as a resource for them to work with. For most small installations like this I would just script something basic to deploy it but after looking around the forums the best I came up with was this...

    "C:\Program Files (x86)\Unity\Editor\Unity.exe" -importPackage "\\XXX-Server\XXXXX\UnityPackages\MoonLander\moon-lander-package.unitypackage"

    And to be blunt it doesn't seem to do a darn thing haha so either I am missing something or barking up the wrong tree completely.

    So I am here asking... is it possible to deploy unitypackages via command line and/or basic script to a large number of computers or am I just out of luck?

    Thank you to anyone who takes a moment to help me out with this issue.
     
  2. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    43
    Hey there,

    I'm not sure if such command line argument exists but maybe you could achieve what you need by adding a C# script in the project that will be executed on editor launch.

    https://docs.unity3d.com/Manual/RunningEditorCodeOnLaunch.html


    You could import the package through C# by calling `importPackage` in the start up script.

    https://docs.unity3d.com/ScriptReference/AssetDatabase.ImportPackage.html

    I'm not sure how the import code will work on a package that's on a server, so you'll have to try it out and see.

    Let me know how it goes!
    Best
     
  3. darenkilley

    darenkilley

    Joined:
    Jun 5, 2019
    Posts:
    2
    Thank you so much for the quick response... I am looking into what you advised but in the meantime would you have any other recommendations in terms of perhaps a better way to do a 'mass deployment' ? I mean I cannot believe we are the first educational site to have to provide a number of students with similar resources haha.
     
  4. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    371
    Packages aren't part of the Unity installation, they can only be part of a project. Unity used to bundle some packages that would show up in the «Import Package» menu but they have moved away from that. There are no globally installed or selectable packages in recent Unity versions.

    Is see two ways deploying a package could work:

    1. Just copy the package to the computers at a specific location. The students then have to import the package from that location when they need it in their projects.

    2. Create a Unity project and import the package. Then deploy this project as a starter project students can use.

    Unity is experimenting with project templates but you cannot create custom ones yet. In the future, another option would be to deploy such a template that includes the package.