Skip to content

SteamVR_Actions broken after Scene reload #616

@Noblauch

Description

@Noblauch

If you use the SteamVR interaction system in Unity and setup default parameters via
SteamVR_Action_Boolean someAction = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("InteractUI");
the interaction system gets broken if you change the button type in the inspector to something other than the default value and then reload the scene in play mode. The problem persists until you restart Unity.

Use this script to see yourself:

using UnityEngine;
using UnityEngine.SceneManagement;
using Valve.VR;

public class InteractionBug : MonoBehaviour
{
    public SteamVR_Action_Boolean button = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("InteractUI");

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

To Reproduce:

  1. Open a new Unity Project
  2. Import Steam VR
  3. Generate the default SteamVR Inputs
  4. Create a new Scene
  5. Delete the Main Camera
  6. Pull in the Player Prefab ( from SteamVR/InteractionSystem/Core/Prefabs )
  7. Add the provided Script to any GameObject in the scene
  8. Go to that GameObject and change the Button in the Inspector to something else as InteractUI
  9. Press play and observe any of the Hand scrips from the Player in scene
  10. Now press space to reload the scene
  11. Observe the Player Hands again and note that the Ui Interact Action has changed to whatever you selected in the provided script to at step 8
  12. The Ui Interact Action is now broken and can't be changed reversed to the original button and Unity must be restarted in order to do so

Or download this project I set up and just try it out (you can skip step 1 - 8 then)
https://github.com/Noblauch/SteamVR_Interaction_Bug

Expected:
The SteamVR_Input.GetAction<SteamVR_Action_Boolean>("InteractUI") function only gets the defined (bound) button for the specific action and doesn't have the ability to actually change or destroy something.

It took me 2 days and overall ~19 hours at work to even figure out what the hell is going on. I really hope this gets fixed and some poor soul finds this post, so he doesn't need to commit -m "suicide"

My question now would still be how to initialize a button for the inspector because this way is breaking the system. However it's actually exactly done like that in the interaction system example scene.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs more informationThis issue needs more information before we can handle it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions