cancel
Showing results for 
Search instead for 
Did you mean: 

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

Metal_Multiball
Heroic Explorer
Problem:  Unity 5.6.1 - Gear VR:  Choppy movements in an almost empty scene.  Samsung Galaxy 8+

If I create a new Unity project and add a simple moving sphere or a default particle emitter and publish to Gear VR, the resulting movement is choppy regardless of frame rate.
Has anyone else experienced this problem.

I will provide details if this is not already a known issue, as I have performed lots of troubleshooting tests already.
I'm hoping the solution is something simple like turning on a setting.  I have setup my project as per the Oculus and Unity documentation.
What I would love is a bare bones, empty, pre-made unity project with all the correct settings for Gear VR set, TimeManager settings, etc.

Thanks,
Steve
47 REPLIES 47

JianZ
Expert Protege
@sfaok , thanks for the project, I did a quick test. it is super weird that I still can't repro.:(

a few more questions

1. when the system prompt to upgrade ovrplugin, did you click yes or no?

2. do you mind to provide an compiled apk ?

Thank you

sfaok
Protege
@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)


JianZ
Expert Protege
@sfaok

Weird, same apk, still no repro, let me try to reset my phone after the weekend,   Thanks

sfaok
Protege
That is very weird. My app built on Unity 5.4.5 works fine on the same phone so its not something universal either.

JianZ
Expert Protege
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.

sfaok
Protege
@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.

JianZ
Expert Protege
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.

Metal_Multiball
Heroic Explorer
This is great news.  Thanks @JianZ and @sfaok

JianZ
Expert Protege
[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.


sfaok
Protege
@jianz Great to hear. Thanks for the tech details too, nice to have some closure (hopefully!)