Log in or register to post comments

Virtual Button + Vuforia 7 = destroy ImageTarget

January 3, 2018 - 4:47am #1



Some weeks ago I had problem with destroying ARCamera when switching the scenes using virtual button. DontDestroyOnLoad script fixed this problem.

After update to Vuforia 7 i wanted to create similar project to the previous one, also using virtual buttons to change scenes.


My sample for optical see through devices:


1 scene: ImageTarget with objects, ImageTarget with Virtual Button and ARCamera (with DontDestroyOnLoad script)

2 scene: Image target with objects, ImageTarget with VirtualButton


After pushing the button to switch scene Ive got this error: 


Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingReferenceException: The object of type 'ImageTargetBehaviour' 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.


When I'm switching device to normal camera (not glasses) I've got one ARCamera in 1st scene and one in 2nd. And with all of this all is fine.


Any ideas how to fix it?


Thank you.




Log in or register to post comments