microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Mixed Reality install requested when running play mode test with asyncLoad.allowSceneActivation = false #9043

Closed nous- closed 9 months ago

nous- commented 3 years ago

Edit: Re-reading allowSceneActivation documentation, shows isDone will never report true so long as allowSceneActivation is false. If you try GetRootGameObjects() at 90% (see doc), it returns an empty list. If isDone, game objects already activated. Leaving this bug open to review the Mixed Reality install behavior & renamed the title.


Per the code below, running a MRTK scene in play test mode using LoadSceneAsync() with allowSceneActivation = false,

  1. Prompts to install Mixed Reality tools (see snapshot below) which isn't required when pressing play directly in the editor
  2. If you install Mixed Reality tools and enable a virtual headset, this launches when running the test
  3. Regardless of installing or not, asyncLoad.isDone never reports true, and the test times out

Removing line asyncLoad.allowSceneActivation = false; causes the scene to load without any issues, independent of whether Mixed Reality is installed.

My goal is to get test control of the same scene used in production by swapping references and scripts, before the default production based scripts activate.

Alternative ideas? I can't see a way to detect test play mode vs pressing play in the editor, or pass complication flags based on running mode, or any other data. Perhaps I'll have a launcher scene for production, that loads the scene the same way the test will, and inject the production driver vs test driver.

Versions:

public class PlayTests
{
   private IEnumerator LoadLevel(string levelName) {
    AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(levelName, LoadSceneMode.Single);
    asyncLoad.allowSceneActivation = false;

    while (!asyncLoad.isDone) yield return null;
  }

  [UnityTest]
  public IEnumerator TestLoadLevel() {
    yield return LoadLevel("Main");
  }
}

image Caption: "Can't open app: The use this app, you'll need to set up Mixed Reality. Go to Start > Mixed Reality Portal or plug in a compatible headset to get started."

stale[bot] commented 2 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

IssueSyncBot commented 9 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!