InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

TrackedPoseDriver.cs using ENABLE_VR

Open icyh4mmer opened this issue 7 years ago • 18 comments

Unity 2019.1 fresh install, I removed and disabled all VR stuff and added InputSystem and for some strange reason it seems that ENABLE_VR is defined by default. I can't find any documentation about this define, is it possible that it's a bug and it's enabled by unityengine?

icyh4mmer avatar Jun 29 '19 16:06 icyh4mmer

I'm 99% certain that ENABLE_VR is part of the Platform Dependent Compilation but undocumented: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html So it should be controlled by the Project Settings options: https://docs.unity3d.com/Manual/VROverview.html

Does it always come back as true even after you disabled VR? @jackpr-unity, do you have any idea about this?

JiaUnity avatar Jul 02 '19 01:07 JiaUnity

@JiaUnity yes, even when I disabled VR it still remained true. I also tried #undef ENABLE_VR and even that wouldn't work.

icyh4mmer avatar Jul 02 '19 15:07 icyh4mmer

Hi @icyh4mmer , that sounds like an engine bug to me. I'd appreciate it if you would file the bug through our bug reporter. You can do so by navigating to the menu bar -> Help -> Report a bug.

jackpr-unity avatar Jul 02 '19 15:07 jackpr-unity

Hi @icyh4mmer - sorry for the delay in getting back to you.

If you're interested in seeing if XR is enabled in 2019.1, I suggest referring to https://docs.unity3d.com/ScriptReference/XR.XRSettings.html

This is not an issue with the InputSystem package, so I must close it. Thank you for bringing this issue to our attention - I'll follow up on it internally. If you find more issues please feel free to reach out through our forums (https://forum.unity.com/) or by filing a bug through the editor (menu bar -> Help -> Report a bug).

jackpr-unity avatar Jul 25 '19 22:07 jackpr-unity

A bit more information: ENABLE_VR is defined at the platform level. It is not affected by disabling settings anywhere. It is used internally to say "hey - this platform might use VR bits at some point somewhere."

jackpr-unity avatar Jul 26 '19 16:07 jackpr-unity

Sorry for the late reply, I was absent for some time. @jackpr-unity So if I understand correctly this is always defined and the input system is using this define and in that case it always references XR which creates a dependency on XR even when you are not using it. So I guess this is still an input system bug, because it is using a wrong define which forces you to enable XR.

icyh4mmer avatar Aug 02 '19 06:08 icyh4mmer

Where do you see ENABLE_VR being used? You mention TrackedPoseDriver.cs in your title. That script is a part of the XR Legacy Input Helpers package, not the InputSystem package.

jackpr-unity avatar Aug 02 '19 17:08 jackpr-unity

@icyh4mmer ^

jackpr-unity avatar Aug 02 '19 17:08 jackpr-unity

@jackpr-unity I'm terribly sorry, I checked everything again step by step and everything seems to be in order, however, there seems to be a bug where you disable a package and it will still somehow stay in the project, and after you enable it again editor will crash, I think this is what happened the last time. I'll try to reproduce the issue and create a ticket, sorry for bothering you :)

icyh4mmer avatar Aug 02 '19 20:08 icyh4mmer

@jackpr-unity Also, I did find the TrackedPoseDriver.cs in InputSystem package: image

icyh4mmer avatar Aug 02 '19 20:08 icyh4mmer

Thanks for pointing out TrackedPoseDriver. I have no idea why that's there. I'm going to have to look more into it.

Thanks for taking the time to help make this all better! I really appreciate it.

jackpr-unity avatar Aug 02 '19 21:08 jackpr-unity

It turns out that TrackedPoseDriver exists in this package because it is very different than the one in the XRLegacyInputHelpers package. That makes sense - it grabs input from this package rather than through legacy means.

Is the existence of this script causing you any problems?

jackpr-unity avatar Aug 02 '19 22:08 jackpr-unity

The ENABLE_VR define shouldn't be causing problems enabling or disabling specific VR SDKs or VR in general. If you're having a problem with that then I would appreciate it if you would file an issue through the editor bug reporter.

jackpr-unity avatar Aug 02 '19 22:08 jackpr-unity

I get the ENABLE_VR defined despite empty new project with no packages at all (really, every single package removed, including disabling all the built-in packages. Only the package manager GUI package is left. This is in Unity version 2019.2.0f1, so definitely a unity bug

olabrahammar avatar Aug 08 '19 10:08 olabrahammar

@olabrahammar as I explained above: ENABLE_VR is a preprocessor directive defined at the platform level. It is not affected by disabling settings anywhere. It is used internally to say "hey - this platform might use VR bits at some point somewhere."

If you're using Windows or Android as your build platform, for example, it is expected that ENABLE_VR will always be set because there are VR SDKs that target those build platforms.

jackpr-unity avatar Aug 08 '19 16:08 jackpr-unity

Ok i see, thanks Jack! This must be new behaviour though, we did not have the ENABLE_VR set in 2018.2.16f1 i believe - we have some older code that uses this flag to decide if to reference Oculus stuff when building for Oculus Go/Android. Do you happen to know what preprocessor directive to use instead, to discern if we are building for VR headset?

olabrahammar avatar Aug 09 '19 11:08 olabrahammar

@olabrahammar

To discern if you are building with VR enabled, I would use https://docs.unity3d.com/ScriptReference/XR.XRSettings.html.

XRSettings.supportedDevices lists out the SDKs that you have enabled in Settings->XR Settings-> VR SDKs.

jackpr-unity avatar Aug 09 '19 16:08 jackpr-unity

@jackpr-unity Sorry for late reply again, just to reply, everything seems fine now, because in the version I'm using now, there is also UNITY_INPUT_SYSTEM_ENABLE_XR in the same #if, and now everything checks out.

icyh4mmer avatar Aug 13 '19 17:08 icyh4mmer