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.

The object of type 'VRTK_TransformFollow' has been destroyed but you are still trying to access it.

See original GitHub issue

Environment

  • Source of VRTK - Github
  • Version of VRTK Github master commit hash 90e829d
  • Version of Unity3D - 5.6.0f3
  • Hardware used - Vive
  • SDK used SteamVR

Steps to reproduce

In an empty scene “SceneA” I have one script following methods:

	void Start () {
            DontDestroyOnLoad(this);
            SceneManager.LoadScene("003_Controller_SimplePointer");
	}
	
	void Update () {
        if (Input.GetKeyDown("l"))
            SceneManager.LoadScene("SceneB");
        }

In “003_Controller_SimplePointer” I have moved all objects into an empty parent object and added in a script:

	void Start () {
            DontDestroyOnLoad(this);
	}

On the press of “l” on the keyboard, as seen in the first script, I load “SceneB” which has just a cube in it and nothing else.

“SceneB” and it’s cube do load into “003_Controller_SimplePointer” but then it starts spewing the error:

MissingReferenceException: The object of type ‘VRTK_TransformFollow’ 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. VRTK.VRTK_BasePointerRenderer.UpdatePointerOriginTransformFollow () (at Assets/VRTK/Scripts/Pointers/PointerRenderers/VRTK_BasePointerRenderer.cs:295) VRTK.VRTK_BasePointerRenderer.FixedUpdate () (at Assets/VRTK/Scripts/Pointers/PointerRenderers/VRTK_BasePointerRenderer.cs:255)

Expected behavior

Controllers continue behaving correctly as per before “SceneB” is loaded.

Require controllers to be persistent and load different scenes as required.

Current behavior

The above error appears, controllers are tracking, but no functionality.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jkafkariscommented, Apr 28, 2017

I tried SetActive false/true on [VRTK] object but it did not work. But if I get “Controller (left)” and “Controller (right)” after they have loaded, SetActive(false) on each of them, load scene in, then SetActive(true) on each again, there are no errors and controllers seem to act as they should. I’ll move forward with this solution unless someone has a better suggestion. Thanks @bddckr for pointing me in this direction!

0reactions
jkafkariscommented, Apr 28, 2017

@bddckr will have a look at your suggestion and get back with results. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with "'GameObject' has been destroyed but you ...
MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Read more >
How to fix "the object of type 'GameObject' has been ...
Set the instantiated object as a variable and you should be fine. ... is destroyed and Instantiate tries to clone null and fails....
Read more >
Destroy(gameObject) is triggering error
this triggers “MissingRefrenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.”.
Read more >
Problem with "'GameObject' has been destroyed but you ...
BUT no matter what I do the HighlightToggle() always says 'GameObject' has been destroyed but you are still trying to access it.
Read more >
The object of type 'CapsuleCollider' has been destroyed ...
1 Answer 1 ... If the player has been destroyed (eg. by taking lethal damage), then every component attached to the player will...
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