Search Unity

Restrict depedency to exact version

Discussion in 'Package Manager' started by GilCat, Dec 9, 2019.

  1. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Is it possible to make a package that will enforce a dependency to the exact version it requires?

    I have created a package that requires TMPro ("com.unity.textmeshpro": "2.0.1") and i want it to no matter what stick to that version and never update to a higher version. The thing is that now with new Unity 2020.1.0a15 it will automatically update to TMPro 3.0 ignoring the info on the package. I would be fine if TMPro 3.0 wouldn't break my code because of API changes in TMPro 3.0 that i can't predict.

    How should i approach this issue?

    Thanks
     
  2. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    104
    Hi there,

    The version that will be installed for a package depends on a lot of factors, and it's hard to put a hard restriction to. And that's especially so when it comes to an upgrade scenario.

    In your case, text mesh pro gets upgraded to 3.0, that is likely because Unity 2020 is not compatible with 2.x text mesh pro anymore.

    Other reasons why a package might not have the same version that you specified in your dependency is due to conflict, and you can read-up more about it here: https://docs.unity3d.com/Manual/upm-conflicts.html.

    Best,
    Ethan
     
    GilCat likes this.
  3. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Well, it is compatible because I can go to my manifest.json and put back version 2.x of TMPro and it works fine.
    I read that up later when at computer. Thanks
     
  4. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    104
    I just did a check on TMPro in Unity 2020.1 and the minimum compatible version is set to 3.0, so officially the version 2.0 is not compatible with 2020.1 anymore. I understand that it works with your machine but there might be some other issues with it that the team decided to mark it incompatible (could be issues on other platforms, etc)
     
  5. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Ok.
    Thank you. I will have that into account.