I’m getting giant, regular spikes of “VR.WaitForGPU” - but ONLY when the active camera isn’t selected in the hierarchy. If I simply select the camera, my FPS goes from 60-100 up to 200.
I’m running 5.4f1 with a Vive.
I’m getting giant, regular spikes of “VR.WaitForGPU” - but ONLY when the active camera isn’t selected in the hierarchy. If I simply select the camera, my FPS goes from 60-100 up to 200.
I’m running 5.4f1 with a Vive.
Side note - the issue persists upon building. Is there some way to tell Unity to act as if the camera is selected, at runtime?
Getting the same thing… the spikes are about 16ms.
I had not noticed that selecting the camera makes a difference, good catch:)
What could be going on here?
Yeah this is crazy, I get it too.
I hadn’t noticed the same lag building though, like mgc mentioned.
To make the issue less annoying (certainly not a fix)
I whipped up a script to select the camera whenever you press play
(just attach to your camera eye object)
using UnityEngine;
#if DEBUG
using UnityEditor;
#endif
//attach this to the object you want to become selected when 'Play' is pressed in the editor
//purpose: to fix the Unity/VR bug where framerate tanks if camera eye isn't selected
public class SelectedOnPlay : MonoBehaviour {
#if DEBUG
SelectedOnPlay() {
EditorApplication.playmodeStateChanged = HandleOnPlayModeChanged;
}
void HandleOnPlayModeChanged()
{
if (EditorApplication.isPlaying)
{
//select this object
if(Selection.activeObject != gameObject)
Selection.activeObject = gameObject;
}
}
#endif
}