Search Unity

UNITY_2019_OR_NEWER not recognised in Unity 2020

Discussion in 'Editor & General Support' started by SimonDarksideJ, Oct 31, 2020.

  1. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    I have assets which support from Unity 2018 and to protect against Unity API changes we rely on the Unity Precompiler directives to ensure compatibility across Unity versions.

    However in testing today, I found that the UNITY_2019_OR_NEWER directive is not recognised by Unity 2020. (just retested in 2019, not recognised there either)

    Neither is UNITY_2020_OR_NEWER.

    I've had to resort to the following for the time being which works as expected but is not future proof by any means.

    Code (CSharp):
    1. #if (UNITY_2019 || UNITY_2020)
    Thoughts?
     
    Last edited: Oct 31, 2020
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    Last edited: Oct 31, 2020
  3. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    It does say the following on that page:
    Also, see this:
    - https://issuetracker.unity3d.com/issues/incorrect-or-mismatch-defines-in-editor-code

    @OP Have you tried
    UNITY_2019_1_OR_NEWER
    and
    UNITY_2020_1_OR_NEWER
    ? Are they getting recognized?
     
    Last edited: Oct 31, 2020
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    Clearly I cannot read. Thanks!
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    Yeah just use UNITY_2019_1_OR_NEWER.