Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

ARFoundation v3.0

Discussion in 'Handheld AR' started by tdmowrer, Aug 29, 2019.

  1. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    3.0.0-preview.1 included some Swift code, which caused a few problems like this. 3.0.0-preview.2 has been released, which no longer users Swift. Try updating to 3.0.0-preview.2 and see if that problem goes away.
     
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Could you try 3.0.0-preview.2 (released today)? It should fix this issue.
     
  3. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Could you try 3.0.0-preview.2 (released today)? It should fix this issue.
     
  4. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    276
    I am building with IL2CPP. The Google Play store requires 64-bit, so everything has to be built using IL2CPP from what I understand.
     
  5. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    I reproduced the issue; it will be fixed in 3.0.0-preview.3.
     
    dnnkeeper likes this.
  6. Andy_liu

    Andy_liu

    Joined:
    Oct 27, 2014
    Posts:
    24
    Thanks for your update, I will try it:)
     
  7. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    10
    I'm using object tracking (using 3d scans), and I see how I can have a reference library with multiple reference object assets, that are connected to one tracked object prefab. How do I go about having multiple Reference Object Assets that are paired up with multiple Tracked Object Prefabs, all in the same scene?
     
    Last edited: Sep 7, 2019
  8. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Each reference object has a name. You can use the string name to determine which one was detected and perform whatever logic you like based on that. See also the ARTrackedObjectManager.trackedObjectsChanged event.
     
  9. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    10
    So I will need to use an if statement?

    If XRReferenceObject.name is detected, then ARTrackedObject equals prefab1.

    Is this the correct logic?
    If not, could you write out a quick example of what the code should look like?

    Thank you.
     
    Last edited: Sep 9, 2019
  10. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Yes, that's what I was suggesting.
     
  11. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    197
    Tried switching from ARFoundation 3.0.0-preview.1 to 3.0.0-preview.2 today and got an error in my build using Xcode 11 beta 6.

    error: Build input file cannot be found: '/path/to/my/xcode/project/Libraries/com.unity.xr.arkit/Runtime/iOS/Dummy.swift'

    This is the Xcode version I switched to last week to get preview.1 building properly. It's the most recent one available.
     
  12. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Try rebuilding the xcode project. You have some files leftover from the previous version.
     
  13. yester30

    yester30

    Joined:
    Mar 4, 2015
    Posts:
    4
    Hi there,
    is there any way I'm missing to apply the humanSegmentationDepthMode automatically on the camera, and have the 3D objects appear behind bodies/hands when applicable?

    In the apple swift example they turn it on & off by changing the session's configuration with
    Code (CSharp):
    1. config.frameSemantics.insert(.personSegmentationWithDepth)
    and it just.. works.

    Is there a way to just enable that, or are we supposed (for now at least) to directly use the depth image & compare it with one obtained from a Unity Camera to sort things manually?
     
    pwshaw likes this.
  14. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    50
    In the current implementation, AR Foundation on ARKit is providing you with the human segmentation images that you need to integrate into your own shaders or rendering setup.

    We are working on improving this functionality and providing a better sample for how to use. This work is in progress currently.

    Todd
     
    unnanego and pwshaw like this.
  15. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    183
    I'm so confused, even after enabling preview packages I can only see ARFoundation 2.2.0 preview.2, 3.0.0 is nowhere to be found. I'm in Unity 2019.2.3f1
     
  16. jordano00

    jordano00

    Joined:
    Jul 3, 2016
    Posts:
    9
    Hello,

    As I was messing around with AR Foundation, I noticed that the center of my mobile device seems to act as the "cursor"?

    I am trying to interact with an object on the scene using void OnMouseDown() and using touch as the "cursor" but what ended up happening is that whenever the center of the screen passes across the object, the object's OnMouseDown() seems to get called and when I try to tap or interact the object with touch, it does not acknowledge my touch.

    The object seems to only be interactable when the middle or center of the screen passes thru it or focus on it with OnMouseDown().

    Any help?
     
  17. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    10
    Thank you for working on this, I will also use this feature as soon as you release a new sample. Really looking forward to it.
     
  18. timbokoppers

    timbokoppers

    Joined:
    Nov 14, 2016
    Posts:
    6
    I can't figure out how that change the prefab on the ARFaceManager. The 'facePrefab' on the ARFaceManager is used to instantiate the prefab when a face is detected. But what I want to do, is while the face is detected, change that prefab (use another prefab with ARFace class on it).
    There isn't a way to remove a trackable (ARFace) with ARFaceManager it seems..

    Thanks, T.
     
  19. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    10
    I'm trying to use a specific XRReferenceObject within a XRReferenceObjectLibrary.

    So what is AR foundation's approach for accessing a variable like this?

    Here's an if statement showing what I'm trying to do:

    if (XRReferenceObject.name, from XRReferenceObjectLibrary, is detected)
    {
    ARTrackedObject equals prefab1;
    }

    I want to make sure I have the correct variable names. Some example code would be extremely helpful. Thank you.
     
    Last edited: Sep 12, 2019
  20. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    911
    After upgrading, I'm getting these errors in adb logcat, they seem to be harmless, everything is still working as usual

    Code (csharp):
    1.  
    2. 2019.09.12 22.47.27.792 2770 2809 Warn Unity The referenced script (Unknown) on this Behaviour is missing!
    3. 2019.09.12 22.47.27.792 2770 2809 Warn Unity (Filename: ./Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 199)
    4. 2019.09.12 22.47.27.792 2770 2809 Warn Unity The referenced script on this Behaviour (Game Object '<null>') is missing!
    5. 2019.09.12 22.47.27.792 2770 2809 Warn Unity (Filename: ./Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 334)
    6.  
    7. 2019.09.12 22.47.27.792 2770 2809 Error Unity A scripted object (probably UnityEngine.XR.ARKit.ARKitLoaderSettings?) has a different serialization layout when loading. (Read 56 bytes but expected 60 bytes)
    8. 2019.09.12 22.47.27.792 2770 2809 Error Unity Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    9. 2019.09.12 22.47.27.792 2770 2809 Error Unity (Filename: ./Runtime/Serialize/SerializedFile.cpp Line: 2135)
    10.  
    Code (csharp):
    1.  
    2. 2019.09.12 22.47.28.218 2770 2892 Error Unity OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
    3. 2019.09.12 22.47.28.218 2770 2892 Error Unity (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 348)
    4.  
    Code (csharp):
    1.  
    2. 2019.09.12 22.47.28.311 2770 2809 Error Unity InvalidOperationException: Cannot start image tracking without an image library.
    3. 2019.09.12 22.47.28.311 2770 2809 Error Unity   at UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem.Start () [0x0001a] in X:\[...]\Library\PackageCache\com.unity.xr.arsubsystems@3.0.0-preview.2\Runtime\ImageTrackingSubsystem\XRImageTrackingSubsystem.cs:39
    4. 2019.09.12 22.47.28.311 2770 2809 Error Unity   at UnityEngine.XR.Management.XRLoaderHelper.StartSubsystem[T] () [0x00015] in X:\[...]\Library\PackageCache\com.unity.xr.management@3.0.2-preview.2\Runtime\XRLoaderHelper.cs:54
    5. 2019.09.12 22.47.28.311 2770 2809 Error Unity   at UnityEngine.XR.ARCore.ARCoreLoader.Start () [0x00049] in X:\[...]\Library\PackageCache\com.unity.xr.arcore@3.0.0-preview.2\Runtime\ARCoreLoader.cs:131
    6. 2019.09.12 22.47.28.311 2770 2809 Error Unity   at UnityEngine.XR.Management.XRManagerSettings.StartSubsystems () [0x0002d] in X:\[...]\Library\PackageCache\com.unity.xr.management@3.0.2-preview.2\Runtime\XRManagerSettings.cs:221
    7. 2019.09.12 22.47.28.311 2770 2809 Error Unity   at UnityEngine.XR.Management.XR
    8.  
     
  21. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    39
    @tdmourer We are working with an AR tool that loads images references and object references at runtime.

    I saw that images now can be loaded for tracking at runtime. Good.

    But what about object tracking? Can I add them at runtime?

    If not, will it be added later?

    Sorry about double posting this, but it is because is a project that is currently using UnityARKitPlugin and we wanted to use ARKit 3 with AR Foundation.
     
  22. thibautvdumont

    thibautvdumont

    Joined:
    Oct 6, 2015
    Posts:
    21
    Many thanks for your help. It isn't ideal as I'd rather have packed this info in the existing managed structure, but it's working fine and indeed way safer. For future reference, that's how you do it :
    Code (CSharp):
    1. struct NativeARPlanePointer {
    2.     int* version;
    3.     ARPlaneAnchor* plane;
    4. };
    5.  
    6. extern "C"{
    7.     ARPlaneClassification ARKitBridge_getPlaneClassification(const NativeARPlanePointer *p) {
    8.         return p->plane.classification;
    9.     }
    10. }
    N.B : be sure to create the corresponding enumeration in the managed code for ARPlaneClassification
     
  23. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    829
    hi arkit 3 and iOS 13 are out of beta. just want to check on the latest ARKit 3 support and which version of Unity works best (has been fully tested for ARKit 3)
     
  24. mkrfft

    mkrfft

    Joined:
    Sep 8, 2017
    Posts:
    7
    Since we migrated to ARFoundation we are unable to disable autofocus on iOS/ARKit. Regardless of the value in ARCameraManager autofocus is enabled on the device. Is there any trick to get fixed focus?
     
  25. Andy_liu

    Andy_liu

    Joined:
    Oct 27, 2014
    Posts:
    24
    How can I change ARSession.state from SessionTracking to Ready? Have any idea? Because when I CheckAvailability again, return SessionTracking, but in some situation, it means not support AR.
     
  26. thibautvdumont

    thibautvdumont

    Joined:
    Oct 6, 2015
    Posts:
    21
    It's enabled by default by ARKit, I think you have no other choice but to change the ARWorldTrackingConfiguration directly in objective-c as ARFoundation doesn't expose it :

    Code (CSharp):
    1.  
    2. struct UnityARSessionPointer {
    3.     int* version;
    4.     ARSession* session;
    5. };
    6.  
    7. extern "C" {
    8.     void ARKitBridge_disableAutofocus(const NativeARSessionPointer *s) {
    9.         ARSession* session = s->session;
    10.         ARWorldTrackingConfiguration * conf = (ARWorldTrackingConfiguration *)session.configuration;
    11.         conf.autoFocusEnabled = false;
    12.         [session runWithConfiguration:conf];
    13.     }
    14. }
    15.  
    Note that this will reset your session completely, so call it first. Also, I did something similar and I remind ARFoundation didn't like it very much, but it's worth trying harder (I did not because I didn't need it in the end).
     
  27. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    65
    I cannot find ARCoreEnvironmentProbeSubsystem - is this subsystem still missing for ARCore?

    Can I access arcore_rendering_utils_api methods to reconstruct LightEstimationApi for such subsystem? I noticed arcore_rendering_utils.aar also missing in the com.unity.xr.arcore@3.0.0-preview.3\Runtime\Android folder so I need to add it to call this method?
    Code (CSharp):
    1. [AndroidImport("arcore_rendering_utils_api")]
    2. public static extern void ARCoreRenderingUtils_GetCubemapTexture(ref int out_texture_id, ref int out_width_height);
     
  28. marcinpolakowski15

    marcinpolakowski15

    Joined:
    Aug 7, 2019
    Posts:
    2
    Many of us have been experiencing a number of issues since switching to ARFoundation and have been posting about them in GitHub. To get any sort of response from Unity is remarkably rare, which frankly I find downright irresponsible. Unity is allegedly a professional product, but teams that rely on it need to deform their production schedule regularly to account for their unresponsive attitude and poorly maintained product.

    For example our team has been experiencing this issue for nearly a month. Not a word from the Unity team, unsurprisingly.
    https://github.com/Unity-Technologies/arfoundation-samples/issues/288#issue-487803923
     
  29. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    43


    • Hi,

      I just update preview.2 to preview.3, this happens:

      Library\PackageCache\com.unity.xr.arsubsystems@3.0.0-preview.3\Runtime\XRSubsytstem.cs(50,40): error CS0115: 'XRSubsystem<TSubsystemDescriptor>.OnDestroy()': no suitable method found to override
     
  30. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    43
    I just change

    #if UNITY_2019_3_OR_NEWER
    protected sealed override void OnDestroy()
    #else
    public sealed override void Destroy()
    #endif

    to

    #if UNITY_2019_3_OR_NEWER
    public sealed override void Destroy()
    #else
    public sealed override void Destroy()
    #endif

    for while, its working... apparently...
     
  31. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    48
    Hi @tdmowrer

    Did you test the scale example since the 3.0 release? Looks like it doesn't wokr anymore on android at least. I was updating a project and cannot figure out what was the issue, but I tried the sample project from github and it's exactly the same issue.
    Looks like something is wrong with the makeappearsat ...
     
    dnnkeeper likes this.
  32. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    65
    Update your Unity to 2019.3.0b5, I encountered the same isssue with previous betas.
     
    clebertavares likes this.
  33. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    65
    I noticed that camera-space canvases stopped working in arfoundation 3.0 on android. I managed to fix this issue by changing ARCameraBackground.cs line 331:
    Code (CSharp):
    1. //camera.projectionMatrix = eventArgs.projectionMatrix.Value;
    2. camera.fieldOfView = Mathf.Atan(1 / eventArgs.projectionMatrix.Value[5]) * 2f * Mathf.Rad2Deg;
    Can't say if setting projection matrix is necessary for anything except fov but for now it works as expected.
     
    Last edited: Oct 4, 2019
  34. KarolisO

    KarolisO

    Joined:
    Feb 2, 2014
    Posts:
    28
  35. superexplosive

    superexplosive

    Joined:
    Mar 4, 2015
    Posts:
    5
    Last edited: Oct 4, 2019
    KarolisO likes this.
  36. superexplosive

    superexplosive

    Joined:
    Mar 4, 2015
    Posts:
    5
  37. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    43
    It worked. o/
     
  38. mdooneymill

    mdooneymill

    Joined:
    Feb 7, 2019
    Posts:
    5
    Hi all,

    can AR Foundation track faces on iOS devices using ARCore (as per this yt vid ) or does it only support ARKit faces at the moment?

     
  39. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    197
    No
     
  40. mdooneymill

    mdooneymill

    Joined:
    Feb 7, 2019
    Posts:
    5
    Succinct. Ta.

    Any idea when this might make it into AR Foundation at all?
    Thanks in advance.
     
  41. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    197
    I don't work for Unity, but my guess would be... never.
     
  42. mdooneymill

    mdooneymill

    Joined:
    Feb 7, 2019
    Posts:
    5
    Any other takers?
    Given that it's now standard functionality it's certainly not an outlandish question.
     
  43. ToonsTech

    ToonsTech

    Joined:
    Apr 10, 2019
    Posts:
    6
    I am using Unity 2018.14.3.f1 and imported Immersal V1.1 SDK. Their instructions cal for using AR Foundation 3.0, ARCore XR Plugin 3.0.0, ARKit XR Plugin 3.0.0. However, the latest version I seem to have is AR Foundation 1.5, ARCore XR Plugin 2.1.2 and ARKit XR Plugin 2.1.2. Do I need to upgrade of Unity 2019 for get these updated plugins? Neophyte ARgonaut
     
  44. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    ARFoundation does not yet support environment probes on ARCore. That is currently being worked on.
     
    dnnkeeper likes this.
  45. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    You need at least Unity 2019.2 to use ARFoundation 3.
     
  46. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    This is not necessary, and any changes you make to the configuration in this way will be lost the next time any setting is changed in ARFoundation. This is exposed in ARFoundation as a setting on the ARCameraManager and there is an API for setting it at runtime.

    This works for me in the latest release (3.0.0-preview.3). What versions of Unity, ARFoundation, Xcode, and iOS are you using?
     
  47. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    My test involves a button which lets me toggle the camera focus mode, and this does work. However, if you start with the focus mode set to "Fixed" and never change it, this is indeed not respected on iOS. Debugging the native code, however, reveals that the ARSession's ARConfiguration does indeed have its autoFocusEnabled property set to 'NO', so this appears to be a bug in ARKit.
     
  48. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    This is what I see in 2019.2.7f2 (2019.2.3 should also work, I just don't happen to have that installed):
    Screen Shot 2019-10-05 at 5.54.28 PM.png
    If for some reason you still don't see it, you can always edit your project's manifest directly. It's at Packages/manifest.json
     
  49. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,292
    Hi, I was interested in testing out the ARWorldMap stuff with a collaborative session and I was wondering if you could recommend a networking solution? I thought maybe Bluetooth might be good because it would be easy for the user but I’m not sure if that would be able to move enough data back and forth. any pointers would be great,
    Thanks!
    Pete
     
  50. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    553
    Apple's MultipeerConnectivity framework is excellent. It's easy to use and "just works". Check out our ARCollaborationData sample, which uses Multipeer.