Restrict depedency to exact version

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

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: Unity - Manual: Resolution and conflict.

Best,
Ethan

1 Like

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

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)

Ok.
Thank you. I will have that into account.