Search Unity

Resolving dependencies on .unitypackage import

Discussion in 'Package Manager' started by r_pid, Mar 5, 2019.

  1. r_pid

    r_pid

    Joined:
    Jul 1, 2013
    Posts:
    4
    Hi there,

    I'm making a plugin which uses a couple of UPM preview packages. Is there an obvious way to automagically resolve those dependencies when final user imports my unitypackage into his project instead of asking them to install packages manually via UPM UI? I already tried messing with package manifest, though I couldn't get it to get picked on the fly by UPM when importing unitypackage. I can, probably, hack it through UPM API, but I feel I'm missing something big time here.

    Thanks
     
  2. benoitv_unity

    benoitv_unity

    Unity Technologies

    Joined:
    Aug 3, 2017
    Posts:
    40
    Hi @r_pid,

    This is something we are actively working on. The plan is to make the change for 2018 LTS. Packages from a .unitypackage will be automatically added or upgraded when the package is imported.

    Regards,
    Benoit
     
  3. r_pid

    r_pid

    Joined:
    Jul 1, 2013
    Posts:
    4
    Got it, thank you!

    One more thing:
    Would you consider it a safe alternative to include a package.json with all dependencies inside an empty folder somewhere within the .unitypackage and ask user to just import this file via UPM to resolve dependencies instead of importing each package manually? This is just a bit less hassle and we can make sure that correct versions are installed. I've tested it, works nicely, however any potential side-effects might be out of my scope.
     
  4. benoitv_unity

    benoitv_unity

    Unity Technologies

    Joined:
    Aug 3, 2017
    Posts:
    40
    Hi @r_pid,

    I believe the .unitypackage is extracted inside the Assets folder of the project. Referencing a package that is inside the Assets folder will cause problems. We also made a change recently (not yet released) that will outright reject packages located there. I suppose it could work if you move that folder out of Assets, perhaps in another folder at the root of the project. I would not recommend it though.

    Regards,
    Benoit
     
  5. r_pid

    r_pid

    Joined:
    Jul 1, 2013
    Posts:
    4
    Hey,

    We already moved to 2018.4 LTS and I'm just wondering if auto-resolving UPM dependencies on .unitypackage import is there already? And if so, how to do this?

    Thanks!