How do i make a restart function with a ARCamera?
I try to make a restart button for my game. I am using different scene's and that works fine but when i try to go back to the first scene it's duplicating my camera and enable my imagetargets. It only shows the colliders. Does somebody know how to fix this?
Answer by HenryStrattonFW · Nov 06, 2015 at 04:10 PM
Check the scripts on the ARCamera, likely scenario is that one of the scripts is doing a "DontDestroyOnLoad()" for the ARCamera object, this means it is not destroyed when moving between scenes.
So whats happening, is you have one ARCamera created in a scene and persisting, you move to another scene, and then you go BACK to the first scene again, that scene loads in the ARCamera object as it is in that scene, so you have two, both marked for non-deletion.
I would suggest modifying the ARCamera script, or adding a separate script to the object, that looks for another object called ARCamera and if it finds one, it destroys itself as it is a duplicate. This should fix the issue for you.
Your answer
Follow this Question
Related Questions
AR Unity Vuforia 0 Answers
Canvas differently displayed in built Android version and Unity Game mode. 0 Answers
How to prevent duplicated gameObjects with disabled camera? 0 Answers
Vuforia: model disappears when getting closer to ImageTarget 2 Answers
How to switch between front and back camera in vuforia? 0 Answers