Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  5. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

ARKit support for iOS via Unity-ARKit-Plugin

Discussion in 'ARKit Preview' started by jimmya, Jun 5, 2017.

  1. dmitriy4leex

    dmitriy4leex

    Joined:
    Sep 21, 2015
    Posts:
    11
    Crash at start

    Hello everyone! May be someone got same problem like me.

    I created my game with ARKit plugin and started this game successful.
    But after some time my game has can't start. Usually after 1 day or after 2 days.
    I created another projects but behavior as in above example

    And i see in setting of device that the camera permission was removed

    iPhone 6s, iOs 11.2.5, Unity 2017.2.0.p2, xCode 9.2

    Please help!
     
    Last edited: Feb 12, 2018
  2. sdprasad

    sdprasad

    Joined:
    Jun 20, 2017
    Posts:
    2
    Have you integrated any unity project having ARKitPlugin into native ios?
     
  3. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    70
    I'm trying to get the image detection to work, but when i try to add the AR Resource Group to unity's create Image.xcassets, the group can't be found:
    [General] No resource group with name "AR Resources" found

    why is that? Does the xcassets have to be in a specific folder? It's included in the Copy Bundle Resources Build Phase.

    Code (CSharp):
    1.     NSSet<ARReferenceImage*>* refImages = [ARReferenceImage referenceImagesInGroupNamed:@"AR Resources" bundle:nil];
    2.     appleConfig.detectionImages = refImages;
    3.     for (ARReferenceImage* img in refImages) {
    4.         NSLog(@"Reference Image: %@", img);
    5.     }
    Edit: Deployment Target was not set to 11.3, so the asset bundle compiler didn't include the AR Resource Group -__-
     
    Last edited: Feb 13, 2018
  4. terop

    terop

    Joined:
    Nov 10, 2017
    Posts:
    2
    iPhone X face-tracking apps built with Unity freezes randomly maybe every 3-4 minutes. Any way to solve this? Someone else had reported the same problem in Bitbucket.

    After that we get this kind of Xcode logs:

    Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
     
  5. wpeay

    wpeay

    Joined:
    Aug 10, 2017
    Posts:
    4
    I bought the suburban house asset off the store. The house will scoot away from me. How can I make the object settle?
     
    Last edited: Feb 14, 2018
  6. shaundavies

    shaundavies

    Joined:
    Jan 31, 2017
    Posts:
    37
    How are you handling the field of view? The film gate i am seeing is custom and I dont know how to replicate the ratio. I am trying to have stereoscopic view and this is throwing it off. I dont want to use render textures.
     
  7. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
  8. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    70
    I created a sample scene for image detection, if you want to test that:
    https://bitbucket.org/mrmatthias/unity-arkit-plugin-image-recognition

    Drag the ARResources.xcassets folder from the ImageRecognition example folder to Xcode after building.
    I disabled the updating of the ARImageAnchors because the positions/rotations didn't make sense.
     
  9. erikparr

    erikparr

    Joined:
    Jan 16, 2018
    Posts:
    4
    Thank you for this! The demo is working for me and its super useful.
     
  10. shaundavies

    shaundavies

    Joined:
    Jan 31, 2017
    Posts:
    37
    Oh that was super easy. Thanks for the info jimmya, I appreciate your work on this.
     
  11. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    30
  12. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    The method that we implemented uses a more flexible way of adding images and image sets to the level rather than messing with the XCode project: https://blogs.unity3d.com/2018/02/16/developing-for-arkit-1-5-update-using-unity-arkit-plugin/
     
  13. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    The problem is that the AR camera is driven through the scene based on the real world position and rotation of the device you hold. So you may be able to push the other virtual objects around, but the position of the camera in the scene will still be relative to the device.
     
  14. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    30
    Just an FYI and a tip for everyone trying out image detection.

    As of right now ARKit only tracks the position and orientation of an image anchor for the first frame it's detected.

    It appears that Apple's intended use case is a statically placed image that spawns the AR scene relative to the detected image, as opposed to continuously tracking a la Vuforia.

    Fortunately you can reset the tracking for an image anchor by removing it from the native ARKit interface. The Unity ARKit plugin has a built in function for removing user anchors, and it also works for image anchors.

    Code (CSharp):
    1. UnityARSessionNativeInterface.GetARSessionNativeInterface().RemoveUserAnchor(arImageAnchor.identifier);
    This is probably a bad idea, but I decided to try it out and see how much of a bad idea it is. If you remove the anchor the frame after it's detected, this is about how fast ARKit can "continuously" track an image.

     
  15. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    This is something that Apple specifically talk about: see the last section of this page: https://developer.apple.com/documentation/arkit/recognizing_images_in_an_ar_experience

    Anyways, nice to see you got it up and running :)
     
  16. alex-micha

    alex-micha

    Joined:
    Apr 18, 2014
    Posts:
    2
    new plugin works great:) wondering if you see any capability to load new images for recognition after a publish to device, say as an asset bundle?
     
  17. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    30
    On this page it says the ARKit API allows target images to be created programmatically using a CVPixelBuffer:
    https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration/2941063-detectionimages

    But elsewhere in the documentation it says images have to be preprocessed. I don't think it's clear if it's XCode that is doing the preprocessing, or if it can be as easy as just passing a native texture pointer and image size during runtime.
     
  18. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
  19. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    Check with ios 11.3 beta - if it's still happening, submit a bug report to http://bugreport.apple.com/ and post the report link here.
     
  20. JelmerV

    JelmerV

    Joined:
    Nov 29, 2012
    Posts:
    126
    I'm using ARInterface on an iOS app, but I can't get a value for ARTrackingState. It returns that it's not available.
    How do I get it?
    And is ARInterface maintained? And/or are there other cross platform (ARKit/ARCore) solutions?
     
  21. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    635
    Hi,

    I've just updated to 1.5 and now get this error message ..

    UnityEngine.XR.iOS.UnityARCamera' does not contain a definition for `lightEstimation'

    Can someone please tell me why, thanks ..
     
  22. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    Can you give more details? Is this in the editor? If so, which file is complaining about this? Could you capture more of the messages around the error? It's more than likely that you have some code in your project that is referencing a much older version of the plugin.
     
  23. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    635
    Hi,

    Sorry it was my mistake, I'm using the UnityARInterface and didn't update it, found your link to the latest version and all seem well again, thanks.
     
  24. Snupiman

    Snupiman

    Joined:
    Sep 7, 2012
    Posts:
    29
    I'm getting the same error with 2017.2.1f1. Just found out in release notes for 2017.3 this: "Fixed various issues in PlayerConnection and EditorConnection, player connect and disconnect should work properly now." Now I hope this is my issue.

    Dunno about face tracking data but you need to have "ARKitRemoteConnection" prefab in the scene to connect. However, on 2017.2.1f1 it gets me to above error.
     
  25. Snupiman

    Snupiman

    Joined:
    Sep 7, 2012
    Posts:
    29
    Had the same error on 2017.3.1. Went back to manual and realized that I missed one step. Turn on "Development Build" but I also turned on "Autoconnect Profiler" before hitting "Build & Run".

    No more connection error! All working now!
     
  26. mirostraka

    mirostraka

    Joined:
    Feb 17, 2014
    Posts:
    24
    hey @jimmya ,thanks for the great work! Is there a reason for discontinuing support for Unity 5 with ARKit 1.5, or is it just discarding old versions of Unity? I ask because I would love to update the game with latest ARKit version, however I do not want to move the project to the new version of Unity at this moment, as I should produce this update very quickly.
     
  27. shaundavies

    shaundavies

    Joined:
    Jan 31, 2017
    Posts:
    37
    Hey is anyone using the new bitbucket update? The script UnityARBuildPostprocessor - I have to add :
    Using UnityEditor.iOS.Xcode;

    Also I cannot get the old UnityArkitRemote app to work with the new update. When trying to connect my phone to unity with remoteConnection i get: Invalid log type 1769104723.

    I also cannot build through Xcode with the new update. Getting many errors repeatedly showing undeclared identifier and unknown name type, basically for anything along the lines starting with AR - i.e. ARReferenceImage
    I have tried to build both the UnityARKitRemote and UnityArVideoFormats; getting same errors.

    I am using Unity 2017.3.1.1f1

    ----
    Am I missing something causing these errors?
     
  28. erenbakac

    erenbakac

    Joined:
    Jan 21, 2016
    Posts:
    2



    I have the same errors after using bitbucket spring apple branch.

    I use
    -2017.3.1.1f1
    -mac os 10.13.3
    -xcode 9.3 beta2
     
  29. norahx3x

    norahx3x

    Joined:
    Dec 2, 2017
    Posts:
    4
    can I know how did you place it on top of the table without changing its position and without touching the screen? thank you
     
  30. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    600
    Hi Jimmy - can you also put in release notes which versions of Unity you have tested the latest unitypackage to work with? There are now many versions of even just Unity 2017 and even a ton of patch versions. Have you tested it to work with 2017.3.1f1?
     
  31. norahx3x

    norahx3x

    Joined:
    Dec 2, 2017
    Posts:
    4
    how did you stop changing plain place after detection? and how you place the object without touch the screen?
     
  32. jonathaniscarroll

    jonathaniscarroll

    Joined:
    Oct 6, 2015
    Posts:
    1
    Hi there -
    We were hoping to use the truedepth front facing camera to snap a grey-scale depth picture (see attached)
    Haven't been able to figure it out from the mesh data in the facetracking example
    Any directions you would recommend?
    Thanks so much!
     

    Attached Files:

  33. erenbakac

    erenbakac

    Joined:
    Jan 21, 2016
    Posts:
    2
    hi @jimmya

    UnityArkitRemote scene is empty in the latest branch(spring). Can you check it please?
     
  34. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    562
    It hasn't changed since last December: https://bitbucket.org/Unity-Technol...yARKitPlugin/ARKitRemote?at=spring2018_update