Search Unity

Bug UNITY_XR_ARKIT_LOADER_ENABLED removing itself from scriptingDefineSymbols

Discussion in 'AR' started by skoteskote, Apr 29, 2021.

  1. skoteskote

    skoteskote

    Joined:
    Feb 15, 2017
    Posts:
    87
    This issue just appeared this week. The scriptingDefineSymbol UNITY_XR_ARKIT_LOADER_ENABLED, which is necessary for ARKIT to work, somehow gets removed from the Scripting Define Symbols list in player settings. I add it, and a few builds later it has disappeared again. This is very frustrating. Anyone knows what might be causing it?
     
  2. skoteskote

    skoteskote

    Joined:
    Feb 15, 2017
    Posts:
    87
    Did some further probing: UNITY_XR_ARKIT_LOADER_ENABLED gets removed when switching from iOS to Desktop build target. This change is then included when changes are pushed to Collaborate, reflecting it on all other users.

    Still very annoying but now we know how to avoid it.
     
  3. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Can confirm - just discovered the same bug and used half a day debugging until I compared player settings with a previous project to find this issue. Why is this define needed?!
     
    Last edited: May 6, 2021
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,821
    A bit of insight from the team:

    This behavior is expected. The UNITY_XR_ARKIT_LOADER_ENABLED define will return when the build target is switched back to iOS with ARKit enabled.
     
  5. skoteskote

    skoteskote

    Joined:
    Feb 15, 2017
    Posts:
    87
    It doesn't always return though, quite often I need to manually put it back after switching to iOS.
     
  6. kpprt

    kpprt

    Joined:
    Jul 30, 2016
    Posts:
    11
    Same here. It doesn't work when switching the platform via scripting, e.g. on automated builds. It feels like Unity is hacking its own Build Pipeline, but doesn't do it properly.

    l don't really understand why the define needs to be removed anyway when switching between platforms. Each platform has its own defines. Why remove a define for iOS when I switch to Android where the define is already not set?
     
    skoteskote and TheVirtualMunk like this.
  7. kpprt

    kpprt

    Joined:
    Jul 30, 2016
    Posts:
    11
    @TreyK-47 Is it possible to get any update on this matter?
     
  8. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Yeah, no, this doesn't work properly at all. I've wasted the whole day on this issue. ARKitBuildProcessor doesn't correctly re-add the symbol if switching to a branch where this wasn't on and looking at the code it seems really rather fragile. UpdateARKitDefines() really should be done in OnPreprocessBuild and instead that doesn't even run if UNITY_XR_ARKIT_LOADER_ENABLED is not already enabled.
     
  9. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,143