unity-game-engineinputhtc-vivesteamvr

How to Share new SteamVR ActionSets and Bindings between Unity Projects


I'm developing a VR module in Unity that I hope to be able to import into any of my unity projects as an asset package. This package requires defining input from a Vive controller button to turn it on during gameplay. I would like to somehow share this actionset and button binding between projects so I don't have to manually create the actions and bindings each time I would like to use it.

Is there any way to share SteamVR input settings between projects? Specifically one whole input actionset, and its associated controller bindings.

I've tried exporting the SteamVR_Input folder as a package, also tried with including SteamVR folder, neither worked. After reimport, I can see the imported actionset in the project folder in the SteamVR_Input folder, but it isn't showing up in the input window (Window Menu -> SteamVr Input). However, the live input view shows the actions in the list, but doesn't register any button presses.


Solution

  • Update Unity 2019.2:

    This seems to be fixed now.

    1. In the source project, go to SteamVR Input window, click advanced.
    2. Create a partial bindings folder. Rename it to what you want. Note that it will automatically add a SteamVR_ prefix. So my default name had SteamVR_SteamVR_ at the start. I needed to delete the suggested name and just name it my project's name.
    3. It creates it in the base folder for your project, NOT the assets folder for some reason.
    4. In Windows Explorer, drag it into Assets folder of source project.
    5. In Unity editor (source project) it should now prompt you to import settings, but it detects that these actions already exist. Click Merge.
    6. Make sure your actionset is still there in SteamVR input window.
    7. Now you can export a unitypackage from this folder.
    8. Now you can import the unitypackage in the destination project, and it should prompt you after import to load the actions! Yay.

    Note: I ran into an issue if I renamed the partial bindings folder after creation. It would not recognize it as actions anymore and not prompt to import. To rename the partial bindings folder, you need to recreate it and follow the above steps again.

    OLD ANSWER (outdated) :

    Note: this answer is working based on a Beta version of the SteamVR plugin 2.2b4. It may change in a future release

    Ok I got this working. It's still not quite possible as far as I can tell to create a unitypackage with the bindings and actions inside, but it's much better than before.

    To move an ActionSet and bindings from project 1 to project 2:

    In the first project: Create a new action set with your desired actions and bindings.

    Go to Window Menu > SteamVR input

    click Advanced settings, then click Create. This will create a folder in your project somewhere.

    This is where the problem is. This folder can't seem to be packaged. BUT:

    Important: In your 2nd project delete the SteamVR_Input folder (you may want to back it up just in case)

    Drag this created folder from the 1st project (from windows explorer) into the Assets folder in the project view of the 2nd project (open in Unity). If you do this outside of unity it will not work.

    It will prompt you to import the "partial bindings" and will add your custom ActionSet to this other project. Open Window Menu > SteamVR_Input in the 2nd project and then you should see your imported ActionSet at the top. Click "Save and Generate" to recreate a new SteamVR_Input Folder for this project.

    Voila! It should work. I haven't got it to be able to be packaged in an asset package yet.