Search Unity

Enabling VR creates a massive amount of input lag when playing without VR

Discussion in 'AR/VR (XR) Discussion' started by Ante, Aug 16, 2015.

  1. Ante

    Ante

    Joined:
    Oct 21, 2010
    Posts:
    48


    This video shows a test scene with only a cursor built with VR support disabled, then with VR support enabled. Fraps added additional lag to the second part, but it's still pretty bad without fraps running. When played with the oculus rift DK2 on in the VR enabled version, there is no lag. I'm not sure what could be causing this. This hasn't always been the case, and I'm going to keep looking for a solution, but I thought I'd post this and see if anyone else might have any idea how to fix this.
     
  2. Ante

    Ante

    Joined:
    Oct 21, 2010
    Posts:
    48
    I just tried this with a brand new project and an otherwise brand new scene. For those interested in seeing the cursor script, it's below. It casts a ray from the camera to draw the cursor on a world space canvas. Pretty simple stuff.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class AnteCursor : MonoBehaviour {
    6.     public RectTransform canvasTransform;
    7.     public LayerMask uiMask;
    8.     void OnGUI () {
    9.         Camera.main.ResetAspect();
    10.         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    11.         RaycastHit hit;
    12.         Physics.Raycast(ray, out hit, 100f, uiMask);
    13.         if (hit.collider!=null){
    14.             transform.localPosition = transform.parent.worldToLocalMatrix.MultiplyPoint3x4(hit.point);
    15.             Debug.DrawLine(ray.origin, hit.point, Color.green);
    16.         }
    17.     }
    18. }
    19.  
    This issue showed up after figuring out that enabling VR also causes my OSX unity editor and standalones to flat-out crash. I migrated from Unity 4 pro to Unity 5 standard for better VR support, but it seems to just be causing very major issues for me at the moment. Considering both of these issues happen in fresh projects that merely have VR enabled, I'm inclined to blame the engine for this. What could be causing this? Is there any fix, or am I going to have to disappoint my VR users by removing VR from future updates until there is one?
     
  3. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Which version of Unity are you using? Please try the latest 5.1 patch release, the latent input bug was fixed there. We plan to still support mac via 0.5.x runtime, but as Oculus announced, Windows + Gear VR is where Oculus' primary focus will be for the near future. So you can expect some rougher edges on the Mac support. But it shouldn't be flat out crashing. Please try the latest patch release and if you are still seeing issues please open a bug report and post the issue here.
     
  4. Ante

    Ante

    Joined:
    Oct 21, 2010
    Posts:
    48
    I updated to 5.1.2p3, which did fix the huge Windows issues, but the standalone still crashes on OSX immediately. I'm going to upgrade my OSX editor and see if it still crashes if I turn on VR there.

    Edit: looks like it no longer crashes. I'll try building my standalones on OSX and see if they work.
     
    Last edited: Aug 17, 2015