How to resume MARS face tracking when app moves from background to foreground

Hello! I’m developing a mobile game that uses MARS face tracking, allowing users to tilt their head and close their eyes as inputs.

I’m running into an issue testing on device:
If the app moves to the background (the user locks their device screen, switches between apps, takes a phone call), upon returning to the app, the MARS Face Mask seems to get stuck, with all transform values frozen where they were when the app became inactive.
However, the EyeClosed/EyeOpened actions are still being triggered as expected.

I’ve tried utilizing OnApplicationPause with various combinations of solutions from other forum posts ( Turn Off MARS Camera , Reset MARS ), but it seems like the only reliable solution is to totally reload the scene, which is not desirable.

Is there a proper way to resume a MARS face tracking session after the app returns to the foreground, without having to reload the scene?

Here’s my code with various attempts commented out:

public class MarsSessionController : Singleton<MarsSessionController>, IUsesFunctionalityInjection, IUsesSessionControl//, IUsesPointCloud, IUsesPlaneFinding, IUsesMarkerTracking, IUsesFaceTracking
    {
        public bool IsActive { get { return !MARSCore.instance.paused; } }
        public Transform FaceRoot { get { return faceRoot; } }
        public Transform MarsCameraTransform { get { return marsCam.transform; } }

        [SerializeField] private GameObject marsSystems = null;
        [SerializeField] private Transform faceRoot = null;
        [SerializeField] private MARSCamera marsCam = null;

        IProvidesFunctionalityInjection IFunctionalitySubscriber<IProvidesFunctionalityInjection>.provider { get; set; }
        IProvidesSessionControl IFunctionalitySubscriber<IProvidesSessionControl>.provider { get; set; }
        //IProvidesPointCloud IFunctionalitySubscriber<IProvidesPointCloud>.provider { get; set; }
        //IProvidesPlaneFinding IFunctionalitySubscriber<IProvidesPlaneFinding>.provider { get; set; }
        //IProvidesMarkerTracking IFunctionalitySubscriber<IProvidesMarkerTracking>.provider { get; set; }
        //IProvidesFaceTracking IFunctionalitySubscriber<IProvidesFaceTracking>.provider { get; set; }

        protected override void Awake()
        {
            base.Awake();

            // Only necessary if this script isn't already in the scene when you press Play
            this.EnsureFunctionalityInjected();
        }

        public void InitializeMars()
        {
            if (marsSystems.activeSelf == false)
            {
                marsSystems.SetActive(true);
            }
        }

        private void OnApplicationPause(bool pause)
        {
            if (pause)
            {
                PauseMars();
            }
            else
            {
                ResumeMars();
            }
        }

        public void PauseMars()
        {
            if (MARSCore.instance.paused == false)
            {
                MARSCore.instance.paused = true;

                //if (this.HasProvider<IProvidesPointCloud>())
                //{
                //    this.StopDetectingPoints();
                //}
                //if (this.HasProvider<IProvidesPlaneFinding>())
                //{
                //    this.StopDetectingPlanes();
                //}
                //if (this.HasProvider<IProvidesMarkerTracking>())
                //{
                //    this.StopTrackingMarkers();
                //}

                //if (this.HasProvider<IProvidesFaceTracking>())
                //{
                //    // ???
                //}

                this.PauseSession();
            }
        }

        public void ResumeMars()
        {
            if (MARSCore.instance.paused)
            {
                MARSCore.instance.paused = false;

                //if (this.HasProvider<IProvidesPointCloud>())
                //{
                //    this.StartDetectingPoints();
                //}
                //if (this.HasProvider<IProvidesPlaneFinding>())
                //{
                //    this.StartDetectingPlanes();
                //}
                //if (this.HasProvider<IProvidesMarkerTracking>())
                //{
                //    this.StartTrackingMarkers();
                //}

                //this.ResumeSession();

                this.ResetSession();
            }
        }
    }

Which platform is this on (Android/iOS)?

It’s happening on iOS only; seems to be fine on Android.

Fixed it by setting the maximum number of faces tracked.

@SpillYerLungs_1 Did you find any solution for the issue?

@CiaranWills Do you have any solution for below scenario?

Actually, I’m also facing the same issue. Face Tracking is not working.

Scenario:

Working on a TryOn Feature using MARS.

  1. Captured a screenshot by placing some jewels on Face and shared the screenshot using some 3rd party share plugin.
  2. Chose email to share and it brings my app in background and moves to email app.
  3. When coming back to my app, Face tracking is not working or Jewels are not tracking the face Whereas it was tracking before moving to background.

Is there any specific number?
I’ve tried “-1” for platform maximum and only “1” also but facing the same.