Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

ARFoundation-based app not linking ARKit package correctly in Xcode?

Discussion in 'AR/VR (XR) Discussion' started by kennyd-itp, Jun 20, 2018.

  1. kennyd-itp

    kennyd-itp

    Joined:
    Jan 13, 2014
    Posts:
    29
    I've set up a test app from scratch to try out the new ARFoundation packages for cross-platform AR on ARKit and ARCore. My code is very similar to Unity's sample project (see https://github.com/Unity-Technologi...es/blob/master/Assets/Scripts/PlaceOnPlane.cs), and I've added the three relevant packages to my manifest.json:

    Code (JavaScript):
    1. {
    2.   "dependencies": {
    3.     "com.unity.xr.arkit": "1.0.0-preview.11",
    4.     "com.unity.xr.arcore": "1.0.0-preview.16",
    5.     "com.unity.xr.arfoundation": "1.0.0-preview.12"
    6.   }
    7. }
    I can build an Xcode project for iOS, but when I try to build in Xcode I get this error:

    clang: error: no such file or directory: '/Users/kenny/AR/Projects/itp-XR-example-unity/Packages/com.unity.xr.arkit/Runtime/iOS/UnityARKit.m'

    Apparently Unity adds a .m file from the ARKit package into the Xcode project with a reference that links to a path inside my project's /Packages folder. However there is nothing in that folder apart from the manifest.json (which I think is correct, since the packages themselves are stored system-wide in a cache folder somewhere).



    What's wrong here? Is Unity generating incorrect references for the Xcode project, or is some other piece of the puzzle missing? Thanks.
     
  2. kennyd-itp

    kennyd-itp

    Joined:
    Jan 13, 2014
    Posts:
    29
    By the way, this is on Unity 2018.1.0f2 and Xcode 9.3.
     
  3. kennyd-itp

    kennyd-itp

    Joined:
    Jan 13, 2014
    Posts:
    29
    After a little more digging it seems this only happens when I check "symlink Unity libraries" in the iOS build settings - which I usually do because it avoids almost a GB of Unity libraries being duplicated on disk for each iOS build. With symlinking turned off, it copies the .m file into the Xcode project folder and everything links correctly.

    The behavior Unity shows when the symlink libraries option is enabled still seems like a bug to me, though - it should symlink to the location where the .m file is actually kept (in Unity's packages cache). Can someone from Unity confirm or otherwise address this?
     
  4. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Yes, it's a bug in the way packages are handled. We've documented this as a known issue, though that's easy to miss. Unity's asset database reports the contents of the ARKit package as "Packages/com.unity.xr.arkit/", but "Packages" is actually an alias that resolves to a cache folder elsewhere on your machine. This does not play nicely with the generated Xcode trampoline project if you check the "Symlink" option.

    Short term, I'm going to add a build preprocess step that checks for this and tells you what's wrong. Longer term, I hope we will be able to support this properly.
     
  5. kennyd-itp

    kennyd-itp

    Joined:
    Jan 13, 2014
    Posts:
    29
    Thanks!