ValveSoftware/steamvr_unity_plugin

[Feature Request] Import SteamVR by leveraging Package Manager's git capability

JaXt0r opened this issue · 0 comments

Following up on #962

Unity's way of packaging dependencies/plugins via git Package Manager is a great way to keep source code separate from package code. https://docs.unity3d.com/Manual/upm-git.html
There are only three changes to SteamVR neccessary to work with this approach:

  1. Have a package.json
  2. (optionally?) rearrance folders to match common examples (e.g. https://github.com/VRMADA/ultimatexr-unity)
  3. Do not create files inside PackageCache folder (where the downloaded packages belong to)

Current behaviour

I put the SteamVR unitypackage files in my own repository and added a package.json file. In my Unity project, I added the reference to this repository in my manifest.json.
Now, if SteamVR is integrated into a Unity project via Package Manager and its git capabilities, it fails with errors as it wants to create folders on top of PackageCache/SteamVR (like PackageCache/SteamVR_Input). The SteamVR plugin itself isn't capable of handling this new behaviour and should look inside /Assets/SteamVR_Input instead.
image

Couldn't create asset file!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Valve.VR.SteamVR_Settings:LoadInstance () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Scripts/SteamVR_Settings.cs:113)
Valve.VR.SteamVR_Settings:get_instance () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Scripts/SteamVR_Settings.cs:18)
Valve.VR.SteamVR_Input:CheckOldLocation () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Input/SteamVR_Input.cs:1312)
Valve.VR.SteamVR_CopyExampleInputFiles:Update () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Input/Editor/SteamVR_CopyExampleInputFiles.cs:26)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
UnityException: Creating asset at path Library\PackageCache\SteamVR_Resources\Resources\SteamVR_Settings.asset failed.
Valve.VR.SteamVR_Settings.LoadInstance () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Scripts/SteamVR_Settings.cs:113)
Valve.VR.SteamVR_Settings.get_instance () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Scripts/SteamVR_Settings.cs:18)
Valve.VR.SteamVR_Input.CheckOldLocation () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Input/SteamVR_Input.cs:1312)
Valve.VR.SteamVR_CopyExampleInputFiles.Update () (at ./Library/PackageCache/com.valvesoftware.unity.steamvr@a0fb60ed97/Input/Editor/SteamVR_CopyExampleInputFiles.cs:26)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <e21ef1ad5a5e4c73a2048dac84671e33>:0)

Expected behaviour

SteamVR plugin should have a package.json file and slightly altered file creation logic to become usable via Package Managers git capabilities.

Further references

People on this repository already mentioned a few workarounds, but I couldn't get it to run due to inconsitencies:

  1. Possible fix #491 --> Unfortunately not all changes (especially on SteamVR_Settings.cs) were ported to the beta release 2.8.x
  2. Same mitigation but still not working as not officially supported by SteamVR plugin: #626 (comment)
  3. #962 - Three years ago, someone already mentioned the package.json way. It got declined as it wasn't Unity standard back in the days. Now the dependency way is standard.
  4. UltimateXR: A project which can be officially integrated via git references as it leverages package.json approach (https://github.com/VRMADA/ultimatexr-unity)
  5. SteamVR's included bundle of OpenVR already leverages package.json (Once .tar.gz is uncompressed, you can put it on a git repository and reference it in manifest.json for Package Manager)

It would be great if we can have a working version to integrate SteamVR into Package Manager for better usability of the plugin.