Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Check if ARMeshing supported on device

Discussion in 'Handheld AR' started by edwon, Jun 11, 2020.

  1. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    201
    Is there a way to check if ARMeshManager (aka Scene Reconstruction on iOS with the new iPad) will work on a given device?

    I need to change some behaviour depending on whether I'm getting planes or meshes from the device (I know you can use both at the same time but it causes issues in my use case)
     
  2. KirillKuzyk

    KirillKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    111
    You can check if meshing subsystem is created by ARMeshManager manager:

    var isMeshingSupported = FindObjectOfType<ARMeshManager>().subsystem != null;
     
  3. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    201
    hmmm I need it in awake, doesn't work on awake
     
  4. KirillKuzyk

    KirillKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    111
    In my experience, you can't check if some AR feature is supported on Awake. You are required to wait until ARSession.state == ARSessionState.Ready and only then you can tell if current device supports specific AR capability.

    If you're running on Android, you also need to account for the case if ARCore is not installed on device and install it with ARSession.Install()
     
  5. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    201
  6. KirillKuzyk

    KirillKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    111
    It seems to me I've found a clean solution without the need to use coroutines and wait for ARSession.state >= Ready. Could you please confirm that device with meshing capabilities will return true?
    Code (CSharp):
    1. public static bool DetermineIfMeshSubsystemSupported() {
    2.     var subsystems = new List<XRMeshSubsystem>();
    3.     SubsystemManager.GetInstances(subsystems);
    4.     return subsystems.Any();
    5. }
     
unityunity