Search Unity

Bug FRONT CAMERA ON IOS WITH MARS

Discussion in 'Unity MARS' started by hiagotruta, Jan 31, 2022.

  1. hiagotruta

    hiagotruta

    Joined:
    Jan 27, 2015
    Posts:
    10
    Hi guys. Somebody here with experience on Unity and iOS? More especiffic with cameras. I'm using Mars Pure and can't make the front camera works on iOS, but on Android everything is working fine. Somebody can help me, please?
     
  2. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    199
    I assume this is for a face tracking scene? In what way does it not work on iOS?

    When it's running from Xcode do you see any errors in the log console?
     
  3. hiagotruta

    hiagotruta

    Joined:
    Jan 27, 2015
    Posts:
    10
    Yes, is with face tracking. In a empty scene works, but when we put the UI canvas (without any script on canvas) the app open just the back camera (using mars). On Android everything works fine.

    And don't have any error on log of console of XCode.
     
  4. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    199
    I'm looking into this. If you are able to, can you file a bug from the editor in your project and DM me the case number? That'll help me track it down faster
     
  5. hiagotruta

    hiagotruta

    Joined:
    Jan 27, 2015
    Posts:
    10
    On editor everything works fine, do not show up any log or error. I'm making a switch Plataform to iOS on Windows with Unity, than i make a build, and take the project to a xcode, the build is successfully, but just show the back camera.
     
  6. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    199
    Which version of Unity and AR Foundation are you using?
     
  7. hiagotruta

    hiagotruta

    Joined:
    Jan 27, 2015
    Posts:
    10
    Unity 2020.3.25f1
    AR Foundation 4.2.1
    Mars 1.4.1
    ARKit 4.1.7
     
  8. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    194
    Hi there!

    I just completed a smoke test using these versions, and as you say, a simple test scene works, using the front camera. However, adding a UI canvas with a button did not cause the issue you are seeing; I still see my face mask through the front camera.

    In your last message, you said you are using AR Foundation 4.2 but ARKit 4.1. Is this correct, or a typo? I tested with both the 4.1 and 4.2 versions of this package but both worked for me. Do you also have the ARKit Face Tracking package installed?

    From our other thread, I understand that you and your team are unable to share your project but are working on an isolation project that replicates the issue. Please share this using the Unity bug reporter or provide a link to download the full project using a file sharing service like Google Drive. Once we are able to replicate the issue we should be able to provide a fix.

    Thanks for reaching out and I hope we can resolve your issue soon. Cheers!
     
  9. gkaras890

    gkaras890

    Joined:
    Jun 26, 2022
    Posts:
    1
    Hello guys! I have created face tracking scene with unity mars! How can I use the rare camera instead of the selfie camera?
     
  10. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    297
    hello @gkaras890,

    MARS Relies on AR Foundation, which also relies on ARKit for working on iOS / ARCore for Android.
    and they both don't support face tracking on rear cameras.
     
  11. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    60
    I'm having the same issue. MARS with Face Mask, works fine on Android but uses the rear camera on iOS (testing on a 2017 iPad). Was there ever a resolution to this issue, or did you find out what causes it? Before I added MARS to the project I was using AR Foundation Face Tracking and it was working fine on the same iOS device.

    Here is something that might be relevant from the Xcode console:

    Code (CSharp):
    1. [Subsystems] Subsystem ARKit-Input already instantiated, returning reference
    2. [Subsystems] Loading plugin UnityARKit for subsystem ARKit-Meshing...
    3. [Subsystems] Failed to initialize subsystem ARKit-Meshing [error: 1]
    4. No active UnityEngine.XR.ARSubsystems.XRFaceSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings.
    5. UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`3:GetActiveSubsystemInstance()
    6. UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`3:EnsureSubsystemInstanceSet()
    7. UnityEngine.XR.ARFoundation.SubsystemLifecycleManager`3:OnEnable()
    8. UnityEngine.XR.ARFoundation.ARTrackableManager`5:OnEnable()
    9. UnityEngine.GameObject:AddComponent()
    10. Unity.MARS.Providers.ARFoundation.ARFoundationFaceTrackingProvider:Unity.XRTools.ModuleLoader.IFunctionalityProvider.LoadProvider()
    11. Unity.XRTools.ModuleLoader.FunctionalityIsland:AddProvider(Type, IFunctionalityProvider)
    12. Unity.XRTools.ModuleLoader.FunctionalityIsland:PrepareProviders(HashSet`1, List`1, Boolean)
    13. Unity.XRTools.ModuleLoader.FunctionalityIsland:InjectFunctionality(List`1, List`1)
    14. Unity.MARS.Settings.MARSSceneModule:Unity.XRTools.ModuleLoader.IModuleBehaviorCallbacks.OnBehaviorAwake()
    15. Unity.XRTools.ModuleLoader.ModuleLoaderCore:OnBehaviorAwake()
    16. Unity.MARS.MARSSession:Awake()
     
    Last edited: Aug 5, 2022
  12. SiddhPurohit

    SiddhPurohit

    Joined:
    Aug 31, 2023
    Posts:
    1
    I am facing the same issue, able to make the front camera work while using ARFoundation and XRPlugin.
     
  13. OmerAslam

    OmerAslam

    Joined:
    Sep 7, 2023
    Posts:
    2
    Please make sure that Face Tracking is enabled in Player Settings -> XR Plug-in Management -> Apple ARKit

    Screenshot 2023-10-09 at 5.41.29 PM.png