Macro for Alpha Versions

Is there any defines macro with the granularity to reach the alpha?
For example i want to have something like this:

#if UNITY_2020_1_0A15_OR_LATER
using VerticalTextAlignment = TMPro.VerticalAlignmentOptions;
using HorizontalTextAlignment = TMPro.HorizontalAlignmentOptions;
#else
using VerticalTextAlignment = TMPro._VerticalAlignmentOptions;
using HorizontalTextAlignment = TMPro._HorizontalAlignmentOptions;
#endif

This is actually the problem i have encounter since Unity 2020.1.0a15 enforces TextMeshPro 3.0 and some bit of the API have changed.
This would allow me to keep backward compatibility while working on the latest alpha of Unity.

you don’t want to #if on the unity version here, but on the TMPro version.
you can use “Version Defines” on your asmdef for that

btw alphas are unstable by definition and constantly changing, don’t try to keep compatibility to a non-latest alpha (you can keep compat between 2020.1 (currently alpha) and 2019.3 with #if UNITY_2020_1_OR_NEWER)

1 Like

That was my original idea but unfortunately TMPro doesn’t have #define for versions (3.0) and adding a version define to my asmdef will enforce my packages to always use TMPro 3.0
My dilemma here is that i want my packages to work on Unity 2019 and on 2020 but on Unity 2019 i can’t upgrade TMPro to 3.0 and on 2020 (after 2020.1.0a15) i can’t downgrade to TMPro 2.x.
Is there a solution for this?

It seems like i can’t downgrade or upgrade from Package Manager but if i edit the manifest.json manually it is possible.
I ended up setting my package dependencies to TMPro 2.x and that will enforce it on any version of Unity that is used.