Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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,671
    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:
    28,189
    Last edited: Oct 31, 2020
  3. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,636
    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:
    28,189
    Clearly I cannot read. Thanks!
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,717
    Yeah just use UNITY_2019_1_OR_NEWER.
     
unityunity