Log in or register to post comments

Problem With Application Focus Change on Hololens

November 27, 2018 - 9:03am #1

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;

}

}

Problem With Application Focus Change on Hololens

December 6, 2018 - 1:50am #3

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.

Thanks,

Vuforia Engine Support

Problem With Application Focus Change on Hololens

November 28, 2018 - 8:22am #2

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

Log in or register to post comments