Search Unity

Reset Scene Messes Up Controller Tracking/Position??

Discussion in 'VR' started by JudahMantell, Mar 16, 2018.

  1. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Hi! I haven't posted here in a long time (if ever) and have gotten into WMR development. So far its been going great. However, I added a script to my controllers that resets the scene when I press the menu button. The problem is, when I reset the scene, the player jumps to where he starts at, but the controllers remain (fully tracked) in the spot where the player was before the scene reset. I haven't found a way to fix this. Any ideas?

    This is the script I'm using:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    using UnityEngine.XR.WSA.Input;
    public class menuButton : MonoBehaviour {
    private Scene scene;
    // Use this for initialization
    void Start () {
    var interactionSourceStates = InteractionManager.GetCurrentReading();
    scene = SceneManager.GetActiveScene();
    }

    // Update is called once per frame
    void Update () {
    if (Input.GetKey("joystick button 6") || (Input.GetKey("m") || (Input.GetKey("joystick button 7"))))
    {
    //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    SceneManager.LoadScene(scene.name);
    UnityEngine.XR.InputTracking.Recenter();
    }
    }
    }
     
  2. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hey @ygm7, that certainly doesn't sound too good. Would you file a bug for us so we can take a look at your repro project. There's a chance it could be a scripting error, but without a full picture of all the scripts at work it's hard to say. Paste the bug number here when you get it and I'll make sure it gets looked at.
     
  3. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Apologies for the late reply:
    Thanks so much! My case number is 1015078
     
    JasonCostanza likes this.
  4. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    @ygm7 just to be sure, have you replicated this in a sterile repro project without the complexities of your full game you're building? I ask because I haven't seen this behavior before.