Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

Run Unity 3D app in background

I have a 3D app built in Unity for hololens, which implements Unet with client and host behaviour. The problem is, every time I suspend it (by making a bloom, f.e.), network part stops working. Is there a way to make my app run in background so I won't loose network behaviour and continue to receive network messages?

Tagged:

Best Answer

Answers

  • Go to player settings.
    Click on Resolution and presentation.
    Make sure Run In Background is checked.

    Taqtile

  • edited February 2017 Accepted Answer

    @mark_grossnickle said:
    Go to player settings.
    Click on Resolution and presentation.
    Make sure Run In Background is checked.

    Tried already, not enough. Server stops listening and client disconnects. I found another solution, you just need to use https://docs.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.ExtendedExecution.ExtendedExecutionSession in your network manager class.
    Here is a good example of it: https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml.cs#L81-L110

    After I implemented Extended Session, everything starts to work fine: Server is listening, client is connected, NetworkBroadcast sends broadcast messages (checked in Wireshark). It might sometimes cause a little problem, for example, if you sent Messages with position, after resuming you can see the Hologram changing position step by step, but not immediately.

    Anyway, it satisfies our needs

  • Wow @AkhmetovTA, impressive research work. I honestly thought this wasn't possible. I've captured your notes and bookmarked this in case I have a customer who needs it. Kudos!

    P.S. I'm assuming this is still governed by the total running application cap, right? Meaning if you try to launch a 3rd or 4th app this process is still eventually suspended correct?

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • @jbienzms said:
    Wow @AkhmetovTA, impressive research work. I honestly thought this wasn't possible. I've captured your notes and bookmarked this in case I have a customer who needs it. Kudos!

    At first I was thinking about implementing background Task class (used to work with them on XAML XBox app two years ago), but then found this. Actually, I'm going to try Background Task few days later.

    P.S. I'm assuming this is still governed by the total running application cap, right? Meaning if you try to launch a 3rd or 4th app this process is still eventually suspended correct?

    Haven't figured yet to be sure 100%.

  • @AkhmetovTA did you ever try the background task approach? If so, which approach did you end up favoring?

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • @AkhmetovTA I'm currently building a Hololens Unity app that also uses UNET. I've implemented ExtendedExecutionForegroundSession. This stops the multiplayer sessions from breaking down after a quick bloom or the Hololens losing it's spatial mapping, but it seems to stop working after around 25-35 seconds if the application is minimized (the client gets kicked out of the networked session). Did you also encounter this issue?

    The extended background task time capability mentions a 25 second time limit, and I added that restricted capability to my manifest, but that doesn't seem to do anything (on its own).

    I've been googling a lot, but this forum topic is pretty much the only resource I've found on this issue. @jbienzms Perhaps you have found some more resources?

Sign In or Register to comment.