Log in or register to post comments

Vuforia reinit after deinit in unity

November 6, 2018 - 6:51pm #1

Hi, guys.

I got a problem with Vuforia VR and AR transition in unity.

I just want to change scene like this...

3D scene -> VR scene -> 3D scene -> AR scene

I tried to make this order workflow but it is not working. 

before I quit VR scene, I used this code.

Vuforia.VuforiaUnity.Deinit(); or Vuforia.VuforiaRuntime.Instance.Deinit();

and Vuforia.VuforiaBehaviour.Instance.enabled = false;

because of these code, I can turn off VR Camera and successfully open 3D scene.

(without this code, I can't open 3D scene because VR camera still working!)

however, whenever I open AR scene after 3D scene, there are some errors and AR Camera is not work.


Could not create dataset.







Vuforia.DelegateHelper:InvokeDelegate(Delegate, Object[])




Failed to set frame format


Vuforia.CameraDevice:SetFrameFormat(PIXEL_FORMAT, Boolean)

Vuforia.CameraDevice:ForceFrameFormat(PIXEL_FORMAT, Boolean)





TransitionManager:Update() (at Assets/SamplesResources/Scripts/TransitionManager.cs:106)


To Sum up, AR camera in AR scene is not working After Deinit() method.

 is there anyway to reinit vuforia


turn off VR camera without using Deinit() method?

Vuforia reinit after deinit in unity

November 12, 2018 - 5:43pm #4

Hi, gsylvain.

I really appreciate your detailed description.

but, I have a few questions.

before I ask you, I think I'd better tell you what I've done.

1. One core scene("Main Scene") which was not based on Vuforia VR/AR sample.

this scene is a kind of platform and connect to the others.

So, When I Play this app, Main Scene is the first scene.

From this scene, I choose other scenes, and if I quit other scenes, I just go back to the Main Scene.

2. Maybe, I will make about a hundred VR or AR scenes.

until now, there are 2 AR scenes and 1 VR scene for test which were based on Vuforia VR/AR sample.

3. So far, there is no problem to repeat Main scene to AR scene transition by using VuforiaBehaviour.Instance.enabled = false without starting scene.

but the only problem is transition from VR scene to other scenes.

there is no way to turn off VR camera without VuforiaRuntime.Instance.Deinit().

if I didn't use this method, I can't turn off VR camera, and VR camera still worked in Main Scene.

that is what i've done and what I want to ask is

1. Did you have VR scene based on Vuforia VR and transition VR to AR or 3D scene?

2. you said you put vuforia setup, camera, image and etc to one stating scene.

In Vuforia AR, as I know, all objects which you want to show after finding image target should be children of ImageTarget.

if I put ImageTarget to starting scene, there is no gameobject in AR Scene. What I understood is right?

3. Is it impossible to put gameobject and script only related to camera and vuforia setting without image target and other objects.

Thanks again, gsylvain.

Vuforia reinit after deinit in unity

November 11, 2018 - 9:21pm #3

Thank you for your quick answer, gsylvain.

I Think your opinion is good and it will be work.

but It will take a time for me.

I will try to do that ASAP.


Vuforia reinit after deinit in unity

November 7, 2018 - 6:35am #2

Our game also have to switch a lot between scenes. To solve that issue, here's what I've done. And you should never invoke VuforiaRuntime.Instance.Deinit() unless you are destroying the app.

1. create a scene with your vuforia setup, camera, image target, etc. Put everything in a single game object. Set the vuforia configuration to "delayed init", disable the component VuforiaBehaviour.

2. early during the game boot, load this scene and do the following in your main "YourProjectVuforiaManager" component, probably at your game object root:

- VuforaBehaviour.Instance.enabled

- VuforiaRuntime.Instance.InitVuforia()

- VuforiaBehaviour.Instance.enabled = true

- DontDestroyOnLoad(that gameObject)

- Then wait for vuforia initialization until VuforiaRuntime.Instance.InitializationState == VuforiaRuntime.InitState.INITIALIZED

- Once vuforia runtime initstate is initialized, you can safely call VuforiaBehaviour.Instance.enabled = false;

3. At this point, all you have to do is toggle VuforiaBehaviour.Instance.enabled = (bool) based on your gameplay needs. You may have to tweak your camera's depth.

4. Please note that your scenes should not contains any vuforia stuff. Try to handle everything from your main vuforia gameobject created at step 1.


The only quite important issue left is that I haven't yet figured how to safely turn off the camera feed. After I set Vuforiabehaviour.instance.enabled = false, I tried to simple access to the vuforia camera and disable it. It seems to work but vuforia is similar to a virus. As soon as I change scene, there is an unknown process that grab the first active camera it can find and attach a new VuforiaBehaviour component on it. At this point, consider your game utterly broken. As a workaround, I simply always let vuforia camera enabled... but it is a battery drain and our device are overheating quite fast, even while in the menus! I would really appreciate if anyone have a fix for that.

Log in or register to post comments