Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Macro for Alpha Versions

Discussion in '2020.1 Beta' started by GilCat, Dec 8, 2019.

  1. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Is there any defines macro with the granularity to reach the alpha?
    For example i want to have something like this:
    Code (CSharp):
    1. #if UNITY_2020_1_0A15_OR_LATER
    2. using VerticalTextAlignment = TMPro.VerticalAlignmentOptions;
    3. using HorizontalTextAlignment = TMPro.HorizontalAlignmentOptions;
    4. #else
    5. using VerticalTextAlignment = TMPro._VerticalAlignmentOptions;
    6. using HorizontalTextAlignment = TMPro._HorizontalAlignmentOptions;
    7. #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.
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    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
    )
     
    GilCat likes this.
  3. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    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?
     
  4. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    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.