question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Teleport Marker doesn't survive scene change

See original GitHub issue

Overview

Running a project with multiple scenes, when a new scene is loaded the Mixed Reality Teleport Script loses its reference to the initial instance of Teleport Marker instantiated in the first scene. The Teleport Manager doesn’t survive the scene load and a new one isn’t created in the new scene.

Expected Behavior

No errors, can select using Controller

Actual Behavior

Three errors, xbox controller no longer functions, can’t select or interact

MissingReferenceException: The variable teleportMarker of MixedRealityTeleport doesn't exist anymore.
You probably need to reassign the teleportMarker variable of the 'MixedRealityTeleport' script in the inspector.

HoloToolkit.Unity.InputModule.MixedRealityTeleport.EnableMarker () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:285)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.StartTeleport () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:214)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.HandleGamepad () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:124)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.Update () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:103)

MissingReferenceException: The object of type 'Animator' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
HoloToolkit.Unity.InputModule.MixedRealityTeleport.PositionMarker () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:316)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.Update () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:109)

MissingReferenceException: The variable teleportMarker of MixedRealityTeleport doesn't exist anymore.
You probably need to reassign the teleportMarker variable of the 'MixedRealityTeleport' script in the inspector.
HoloToolkit.Unity.InputModule.MixedRealityTeleport.DisableMarker () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:298)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.FinishTeleport () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:236)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.HandleGamepad () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:129)
HoloToolkit.Unity.InputModule.MixedRealityTeleport.Update () (at Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs:103)

Steps to reproduce

Create a project with two scenes. Load initial scene then load second scene. Use xbox left thumbstick.

You can see that the Mixed Reality Teleport Script on MixedRealityCameraParent in the Unity Editor is null.

Unity Editor Version

2017.2.op1-MRTP4

Mixed Reality Toolkit Release Version

master

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
genereddickcommented, Nov 26, 2017

Three options:

  1. Instantiate TeleportMarker as a child of MixedRealityCameraParent. Then doesn’t require DontDestroyOnLoad, but not sure of any implications of tying the position and rotation of the TeleportMaker to the camera.

  2. Make TeleportMarker a Singleton. Will both survive the scene load and will retain the reference in MixedRealityTeleport.

  3. Add some code to handle rewiring the object in MixedRealityTeleport. This could be done either through re Instantiating the TeleportMarker (in which case it doesn’t need DontDestroyOnLoad), or just use Find to grab it and reassociate it (if TeleportMaker has DontDestroyOnLoad).

In MixedRealityTeleport.cs:

 private void Awake() {
    SceneManager.sceneLoaded += SceneLoaded;
}

 void SceneLoaded(Scene scene, LoadSceneMode mode) {
    if (teleportMarker != null) {
        teleportMarker = Instantiate(teleportMarker, this.transform);
        teleportMarker.SetActive(false);

        animationController = teleportMarker.GetComponentInChildren<Animator>();
        if (animationController != null) {
            animationController.StopPlayback();
        }
    }
}
0reactions
wiweicommented, Apr 11, 2019

Closing issues older than 180 days. If this is still an issue, please reactivate with recent information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Teleport the Player to a different position after scene switch
I am new to the adventure creator and I would like to teleport the Player to a different position after scene switch (not...
Read more >
Session Marker gets reset when I "Teleport To"
I was using the tools->session marker->teleport functionality earlier today and it was working. That said, given the quality level of the game, ...
Read more >
Teleport a Player to other scene to a specific point
Hi Guys, i have a problem with my change level script. For exampel i have at the moment two scenes worldmap and scene...
Read more >
This may sound absurd, because I don't know how to ...
No, the missing component of teleportation is not abrupt and dramatic temperature change. Instead, what is missing is a reliable and safe way...
Read more >
Farming Simulator 22 - Easy Development Controls - YouTube
Teleport : Quickly move yourself or vehicles around the map by selecting a ... Advance Growth: Advances all crops to the next growth...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found