Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Open Scene

Is there any way to close a scene and open a new scene with a HoloLens voice command?
Thanks!

Tagged:

Best Answer

  • holonutholonut
    Answer ✓

    The way I did it was by creating two different parent gameobjects, one active one inactive, both with identical children gameobjects of different sizes.
    I then used a Speech Input Source and Input Handler keyword to swap which one was active.
    It works fine but the file size is quite large.
    Remember that you should only use single words for keywords.

Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited November 2017

    Hey, @holonut

    There are two things to this functionality. You will need to recognize a voice command first. And you will need to load the new scene second.

    To recognize the voice command use the KeywordRecognizer class.

    And to load a new scene use the SceneManager.LoadScene() method.

    You may also want to do some branching a'la go to different scenes depending on which voice command exactly got recognized.

    Hope this helps.

    Building the future of holographic navigation. We're hiring.

  • dbarrettdbarrett ✭✭✭
    edited November 2017

    Create an empty game object, then attach the Speech Input Source and Speech Input Handler component to it. Make sure Source is above Handler in the hierarchy. Then type in the word you want to use in source, and save your project and deselect your object. Select the object again and go to the Handler. Under the handler you can add your method to change scenes.

    Also make sure you have the microphone capability turn on under the player settings and enable is a global listener on your Handler.

    As far as changing scenes go, you can do something like Application.LoadLevel(SceneName), I am pretty sure there is another way to load the level as I believe this method is going to be depreciated soon in Unity.

    AR Developer

  • Thank you. Will I be able to pre-load a scene as well? The goal that I have is to have two identical scenes that are two different sizes (Approx 1/5). When the hololens user says "Resize" the hologram INSTANTLY switches between the two different sizes of holograms/scenes. Thx!

  • I'm not sure, I've never done anything like that. Why don't you just change the scale of all of your objects when say "Resize"?

    AR Developer

  • Just as @dbarrett suggested, it seems like an easier way to simply swap game objects' visibility or scale.

    Building the future of holographic navigation. We're hiring.

  • I guess easier said then done. I just don't know how to do it. I am guessing I would need to write a c# script that would take care of this action? I have this along with another action that needs to be completed. Where is the best place to post a job request for someone to help me out with it? Thx!

  • A very simple method, simulating doubling the size of the object this script is attached to.
    public void Increase() { transform.localScale += transform.localScale; }

    Decrease would be the same except you would put a -= instead. Or you can Increase and Decrease by a certain Vector3.

    AR Developer

  • holonutholonut
    Answer ✓

    The way I did it was by creating two different parent gameobjects, one active one inactive, both with identical children gameobjects of different sizes.
    I then used a Speech Input Source and Input Handler keyword to swap which one was active.
    It works fine but the file size is quite large.
    Remember that you should only use single words for keywords.

Sign In or Register to comment.