Gvr-unity-sdk: iOS hybrid app framerate drop

Created on 15 Mar 2018  路  11Comments  路  Source: googlevr/gvr-unity-sdk

An issue exists with iOS and switching between VR and non-VR mode.

I noticed that when introducing this to my Unity projects, the iOS framerate dropped substantially below 60fps, and became noticeable.

It took some hunting, but taking "None" out of the XR Settings and just leaving "cardboard" gave me stretched 2D screens, but the VR view returned to fast framerate.

So looking at https://developers.google.com/vr/develop/unity/guides/hybrid-apps, I noticed this line:
// No longer needed, see issue github.com/googlevr/gvr-unity-sdk/issues/628.
// cam.ResetAspect();

and found that actually doing this ResetAspect call made everything work as normal, when "cardboard" is the only selected Virtual Reality SDK.

It's worth noting that this was never an issue for me on Android, and the fix to issue 628 may have fixed both the screen stretch and the frame rate inadvertently.

Unity bug

Most helpful comment

We mitigate this with the following after entering VR:

// Since Unity 2017 (?) the iPhone defaults to 30 fps which is too slow.
// Explicitly request 60 fps. Also set the vertical sync count to zero so it doesn't interfere.
Application.targetFrameRate = 60;
QualitySettings.vSyncCount = 0;

Then, after leaving VR we do this:

// restore the default frame rate
Application.targetFrameRate = -1;

All 11 comments

It might be worth reopening this, as it seems strange that having "None" in the list of XR Devices causes this framerate issue? Especially when its outlined in https://developers.google.com/vr/develop/unity/guides/hybrid-apps that it is required.

This is something I have also encountered.

I've noticed this too and it seems as though Cardboard needs be setup as the first VR option in XR Settings for the videos to perform well.

I currently have Cardboard loaded up first then waiting for a fraction of a second then loading "None".
The split screen in portrait mode isn't visible on my iPhone 6 but I did notice if you set your app to Landscape left or held your phone on landscape (with auto rotate) the split screen is visible.

I'm looking through the gvr source code to see if there is anything in there.

We mitigate this with the following after entering VR:

// Since Unity 2017 (?) the iPhone defaults to 30 fps which is too slow.
// Explicitly request 60 fps. Also set the vertical sync count to zero so it doesn't interfere.
Application.targetFrameRate = 60;
QualitySettings.vSyncCount = 0;

Then, after leaving VR we do this:

// restore the default frame rate
Application.targetFrameRate = -1;

That's a great idea, cheers Adam

Thanks Adam. That worked perfectly for me.

Thanks Adam!

We're working with Unity to get this addressed.

@rusmaxham Good to know - it is subtle and relates to their API internals

This is now fixed in Unity 2017.4.4f1, 2018.1.2f1, and 2018.2.0b4.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings