"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Problem With Application Focus Change on Hololens

I have the following problem with the Vuforia image tracking on the Hololens:

Vuforia Version: 7.5.26 Unity Version: 2018.2.17

  • Start an application with an image tracking
  • image tracking works
  • Use the bloom gesture and select "Mixed Reality Home" to put the application in the background
  • Click the application window again
  • image tracking does not work anymore

I cannot reproduce the same behaviour on the unity editor.

Workaround: Disable the vuforia behaviour on focus lost and enable it again on focus with a delay.

This seems like a bug to me.

------

using System.Collections; using UnityEngine; using Vuforia; /* * Script to disable Vuforia components on application focus lost and re-enable delayed on application focus, * because tracking does not work anymore on Hololens after an application focus change. */ public class VuforiaAppFocusHandling : MonoBehaviour { [SerializeField] public GameObject ArCamera;

private void OnApplicationFocus(bool hasFocus) {   Debug.Log(hasFocus ? "Application has Focus" : "Application does not have focus");   EnableTracking(hasFocus); }

public void EnableTracking(bool track) {   if (track)   {    StartCoroutine(DelayedEnable(true));   }   else   {    EnableVuforiaComponents(false);   } }

private IEnumerator DelayedEnable(bool track) {   yield return new WaitForSeconds(0.5f);   EnableVuforiaComponents(track); }

private void EnableVuforiaComponents(bool track) {   ArCamera.GetComponent<VuforiaBehaviour>().enabled = track;   ArCamera.GetComponent<DefaultInitializationErrorHandler>().enabled = track; }

}

Hello,

Thanks for the report. We've identified a similar issue and are investigating.

I'll update this thread with relevant details as they become available.

-Vuforia Engine Support

JohannesS

Thu, 12/06/2018 - 09:50

Hi,

Vuforia should pause and resume automatically if you disable "Run in Background" in the Unity player settings.
We recommend to always disable this setting, in particular on HoloLens where two apps cannot run side by side in the foreground anyways.