Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Unity 5.6.1 - Gear VR: Choppy movements in an almost empty scene

2»

Comments

  • sfaoksfaok Posts: 193
    Art3mis
    @JianZ

    1. Not sure, probably yes. This bug isn't limited to this version of Unity though, same thing happens in 2017+.

    2. Here's an apk (link)


    Developer of Ocean Rift.
    Follow me on Twitter @sfaok
  • JianZJianZ Posts: 65 Oculus Staff
    @sfaok

    Weird, same apk, still no repro, let me try to reset my phone after the weekend,   Thanks
  • sfaoksfaok Posts: 193
    Art3mis
    That is very weird. My app built on Unity 5.4.5 works fine on the same phone so its not something universal either.
    Developer of Ocean Rift.
    Follow me on Twitter @sfaok
  • JianZJianZ Posts: 65 Oculus Staff
    hey @sfaok,  I'm able to repro the issue with a factory reset phone, I'm trying to debug if is a VrApi issue or an Unity bug now. thanks  

    you mentioned it works fine under 5.4.5, but not the later versions, which makes me suspect the problem was introduced from certain unity version, I'll try to bisect that now,  
    Btw, do you still have your 5.4.5 repro project?  the 5.6 version repro can't be load by 5.4,   it would be very helpful if  5.4 repro is still available,  otherwise, I can try to build a low version repro project myself,  thanks a lot.
  • sfaoksfaok Posts: 193
    Art3mis
    @jianz great to hear you've been able to repro the issue.

    When I mentioned 5.4.5 working ok, what I meant was an old apk of my app built on 5.4.5 runs without issue on the S7 phone (its the same apk that's live on the store). The repro project I shared here was made specifically in 5.6 to demonstrate the issue sorry.
    Developer of Ocean Rift.
    Follow me on Twitter @sfaok
  • JianZJianZ Posts: 65 Oculus Staff
    Just an update,  we are making progress on the "back button" issue,  
    Unity main thread was supposed to locked on Big cpu Core (  for S7 EU version, it should be 4-7 ),  but the thread affinity info was reset to 255 after the app paused / resumed,  so the thread runs on little cores ( 0 -3 ),  which is why the performance becomes worse, we are debugging to see if the problem comes from Unity side or System side,  will update here once we had a conclusion.
  • stevehinanstevehinan Posts: 89
    Hiro Protagonist
    This is great news.  Thanks @JianZ and @sfaok
  • JianZJianZ Posts: 65 Oculus Staff
    edited September 2017
    [BackButton issue ]

    Hey Guys, I think we got the root of the problem, it is actually a general unity android issue from what our understanding so far ( not vr specific), we are able to test a fix and created a PR for our Unity partner to merge, will update here when we hear back from our partner about detail release schedule, thanks everyone's help on the repro projects


    Tech details below if anyone care about the exact reason.
    .Most mobile phones today are using Big.Little CPU architecture, Big cores for performance , little cores for saving energy. For achieving a better performance, Unity optimized it to lock certain threads ( including Unity main ) on Big cores by setting Thread affinity mask,  however, when player hit back buttons, the android activity will be push into background,  the OS will do a bunch of stuff mess with core affinity eg, put threads onto small cores for power saving,  then after switch the app to foreground again, their original  thread affinity had been lost,  so those unity thread won't be able to run on the cores they were optimized for.  that' why we see UnityMain start running on little cores.   For fixing this problem, we have to store all thread affinity before the app was paused, then restore them after the app was resumed.  Basically, app/engine has the responsibility to restore the thread affinity.  Unity seems missing this part of code to handle cases like this ( from what I see ).  which means all unity versions having problems ( yes, including 5.4, I'm able to repro the problem on 5.4 as well ),  but it certain affect VR apps more than other android app since VR is very performance hungry,  also this affect certain phones more seriously (like S7 EU / S8 EU / S8 US)  because those phone little cores is much weaker than big cores. (Also, the problem is not always reproducible since Unity main can run on the wrong cores, it can also run on the correct cores by chance )

    Extra: if you turn off multithread rendering under your Unity player setting, the problem is less severe,  but we totally understand this is not a valid workaround.


  • sfaoksfaok Posts: 193
    Art3mis
    @jianz Great to hear. Thanks for the tech details too, nice to have some closure (hopefully!)
    Developer of Ocean Rift.
    Follow me on Twitter @sfaok
  • southpacsouthpac Posts: 19
    NerveGear
    Hi,
    It looks like I have the same problem when returning from "Exit to Oculus Home?" screen. 

    Has anyone tried if this got fixed with 2017.2.0b11 that was released yesterday (depending on where in the world you are)?

    Cheers 
  • JianZJianZ Posts: 65 Oculus Staff
    @southpac , the fix is not released yet
  • stevehinanstevehinan Posts: 89
    Hiro Protagonist
    Hi @JianZ

    I hope you are doing awesome!
    I saw this in the Unity 2017.2 beta release notes and am wondering if this is the fix you have been working on:

    XR: Improvements to the way that XR devices can pause/unpause applications, particular with respect to pausing from application focus lost. Overlapping pause conditions are now handled correctly, regardless of the order in which they occur.

    p.s. if you want to be on the beta list of my new Gear VR game, just send me your Oculus login email and I will add you.  It is possibly the best game ever made.


    Thanks,
    Steve
  • JianZJianZ Posts: 65 Oculus Staff
    Hi @stevehinan

    I don't think that is it.
    According our Unity partner, the patch fix is scheduled in  5.6.4p1 .
    For Unity 2017 and later version, they plan to do some deeper refactor to fix it more properly,  I'll update it here once we get their release schedule.
  • JianZJianZ Posts: 65 Oculus Staff
    Hi @stevehinan and everyone

    the back button issue should be fixed under Patch 5.6.4p1, thanks for all the helps 

    https://beta.unity3d.com/download/e67c4b7007d5/UnityDownloadAssistant-5.6.4p1.exe?_ga=2.168754722.2038378753.1508797842-60660381.1486692714


    Jian
  • stevehinanstevehinan Posts: 89
    Hiro Protagonist
    Thanks @JianZ,
    Please still let us know when the fix is scheduled for Unity 2017.
    Thanks for enabling the fix!
  • JianZJianZ Posts: 65 Oculus Staff
    edited December 2017
    Fix verified under 2017.1.2p4 / 2017.2.0p3/ 2017.3.0f2
  • stevehinanstevehinan Posts: 89
    Hiro Protagonist
    Thanks @JianZ
2»
Sign In or Register to comment.