-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support overlay mode? #108
Comments
Any updates on this? We really just need an option under the native openvr support settings to set what kind of EVRApplicationType type we want OpenVR to be initialized as. Right now it seems to be hardcoded as VRApplication_Scene, we just need a dropdown to be able to change that to whatever application type we need. |
I'll add that to the steamvr settings object. |
Actually it looks like this is done at the unity level now, we may have to roll this into a unity 2019 xr sdk thing. I'll look into it further. |
The initialization is done by Unity, if you have OpenVR turned on in Unity. However the Unity XR stuff does not do overlays and IMHO just about everything that is done in Unity XR is not needed for building overlays. IMHO building overlays should be done by using the SteamVR Plugin, turning Unity's VR handling off, calling the OpenVR Initialization with an overlay type yourself, and setting a setting that tells the SteamVR Plugin NOT to disable itself when it sees that the Unity XR code is not running. |
I'm already building an overlay using the SteamVR Plugin: I have the Unity XR stuff disabled. I init the overlay stuff myself. And I copy a few parts of the SteamVR plugin like the EventLoop for which the built-in one doesn't run because the StreamVR Plugin disabled itself. The one caveat is there are some places like SteamVR Input that I can't copy things to get working because the references to the The latter two things should not be required. The plugin already has a built in event loop and APIs like the Input API also seem to work in an overlay. The only problem is that when the |
Yeah, same here. The SteamVR Unity Plugin is unusable without heavy modification, and even then only parts can be utilized, not to mention that it becomes impossible to update it when updates come around. |
It looks like some parts of the plugin can be called independently and will then initialize OpenVR if needed (most often as the Utility app type) and calls Shutdown once done. I would like to see a single place handling the automatic initialization and there being a way to disable it. If the same method it calls to initialize is public API that would be even better - this way users don't have to reinvent the wheel in case they want to delay turning on VR or support non-VR gameplay and want to allow switching at runtime. |
I can confirm there is very little in the plugin that actually references the Unity XR runtime. UnityXR is of course relied on to handle rendering scenes, but that functionality is not needed/desired when running an overlay.
I got SteamVR to startup by adding an extra standalone mode that calls OpenVR.Initialize and disables the XRSettings checks. And of course turning off |
Most things seem to work well:
The issues I've had so far are minor and mostly not actually issues related to running the plugin in an overlay:
|
…XR enabled Standalone mode is primarily intended for SteamVR overlays where it is undesirable for Unity to initialize itself as a VR application and render a scene. In order to run standalone: - autoEnableVR must be disabled in SteamVR_Settings - "Virtual Reality Supported" must be disabled in Unity's project settings - openvr_api.dll will not be handled by Unity so the dlls for the relevant platforms must be downloaded and included in the project with the proper import settings (you may need to manually copy the dlls into the standalone build version) - To initialize an overlay you must create a behaviour that calls `SteamVR.InitializeStandalone(EVRApplicationType.VRApplication_Overlay);` to enable SteamVR functionality - If you use SteamVR scripts that initialize SteamVR on Awake you may get initialization warnings if they run before your initialize behaviour - Since Unity's XR support is disabled you of course need to interact with the `OpenVR.overlay` directly in your own scripts Implements most of the functionality required by ValveSoftware#108
Here's a branch with the changes I made #336. I implemented it adding a However if it is preferable to implement an explicit "overlay mode" (perhaps also with a "background mode") and not write code to initialize it. Then I could redo it so I add a setting to SteamVR_Settings to allow switching to overlay/background mode. |
I believe this feature has been added and should work now. If not please create a new issue with repro steps and ideally an example project. Thanks! |
@zite I strongly doubt that this feature has been added. As the This is a request for adding support for running in overlay mode. There is no way to write an example project for something that doesn't exist. I did however go further than that. I wrote a PR implementing standalone/overlay support #336. |
Is Valve willing to support using the SteamVR Unity Plugin for creating SteamVR Overlays?
After experimenting a bit and digging into the code. It appears as if nearly everything needed to make overlays is available in the plugin. There's enough here it would likely be more productive to tweak the plugin to support overlays, than to implement overlays from scratch using openvr_api.
From what I can tell, the primary thing stopping overlays built in Unity with this plugin from being viable is that when Unity's XR handling – which initializes itself as a scene renderer – is disabled so you can initialize your app as overlay-only. The SteamVR class decides it cannot function and never creates an instance. And as a result the majority of the plugin just simply fails on
SteamVR.instance
. Even when the code is just doing something as simple as checking the textureType. Even when the code doesn't need UnityXR's rendering. And even though the plugin already appears to do most of the pose tracking, etc... itself without UnityXR.The text was updated successfully, but these errors were encountered: