Log in or register to post comments

AR crashes after returning from another scene

August 11, 2015 - 4:15am #1

Unity version: 5.0.2f1

Vuforia version: v5.0.5

Xcode version: 6.1.1

 

This only happens on our iOS devices. We don't have the same issues in the editor.

In our project we have an AR scene that handles all of the AR in the app. Everything Vuforia/AR is contained within here. This all works fine the first time we visit the scene however, if we navigate to another scene using Application.LoadLevel, then return to our AR scene the app will crash once the AR GameObjects are enabled.

I could be wrong but this issue seems to involve the VideoBackgroundBehaviour script attached to the Camera child of ARCamera. If I disable this script I don't receive the crash on device when returning to the AR scene and the AR will continue to track and function, although there is no video background feed displayed.

I've attached the crash log below. This statement seems to stand out to me...

appName[734:290616] VideoBackgroundConfig with screen size of zero received, skipping config step

Does anyone have any suggestions or work arounds to get the AR working after returning to the scene? Thanks.

 

Vuforia.DataSetImpl:Load(String)

Water:sgn(Single)

Vuforia.DatabaseLoadAbstractBehaviour:LoadDatasets()

Vuforia.VuforiaAbstractBehaviour:Start()

System.Collections.Generic.Dictionary`2:<CopyTo>m__0(BadgeTypes, Boolean)

 

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)

 

objectTrackerActivateDataSet

StartVuforia

System.Collections.Generic.Dictionary`2:<CopyTo>m__0(BadgeTypes, Boolean)

UnityEngine.Debug:Internal_Log(Int32, String, Object)

UnityEngine.Debug:Log(Object)

Vuforia.VuforiaAbstractBehaviour:StartVuforia(Boolean, Boolean)

Vuforia.VuforiaAbstractBehaviour:Start()

System.Collections.Generic.Dictionary`2:<CopyTo>m__0(BadgeTypes, Boolean)

 

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)

 

cameraDeviceInitCamera

2015-08-11 11:59:07.505 appName[734:290616] *** -[AVCaptureVideoDataOutput setVideoSettings:] - videoSettings dictionary contains one or more unsupported (ignored) keys: (

    Width,

    Height

)

cameraDeviceGetVideoMode

2015-08-11 11:59:07.519 appName[734:290616] VideoBackgroundConfig with screen size of zero received, skipping config step

cameraDeviceSelectVideoMode

cameraDeviceStartCamera

markerTrackerStart

objectTrackerStart

cameraDeviceGetVideoMode

cameraDeviceGetVideoMode

2015-08-11 11:59:08.237 appName[734:290616] WARNING: GoogleAnalytics 3.06 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:49): Uncaught exception: *** -[__NSArrayM objectAtIndex:]: index 18446744073709547520 beyond bounds [0 .. 1]

2015-08-11 11:59:13.348 appName[734:290616] Uncaught exception: NSRangeException: *** -[__NSArrayM objectAtIndex:]: index 18446744073709547520 beyond bounds [0 .. 1]

(

0   CoreFoundation                      0x0000000185a61e64 <redacted> + 160

1   libobjc.A.dylib                     0x00000001964640e4 objc_exception_throw + 60

2   CoreFoundation                      0x000000018594777c <redacted> + 0

....

44  libdyld.dylib                       0x0000000196ad2a08 <redacted> + 4

)

2015-08-11 11:59:13.351 appName[734:290616] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 18446744073709547520 beyond bounds [0 .. 1]'

AR crashes after returning from another scene

November 11, 2015 - 7:16pm #17

Looks like there are certain exceptions for Resources.UnloadUnusedAssets(). You might try omitting that as well and check the result.

http://docs.unity3d.com/ScriptReference/Resources.UnloadUnusedAssets.html

AR crashes after returning from another scene

November 10, 2015 - 9:51pm #16

Happens with or without Application.UnloadLevel()  I am also calling resources.unloadunusedassets after leaving each scene.

AR crashes after returning from another scene

November 10, 2015 - 6:14pm #15

Does the memory leak occur if you omit the explicit call to Application.UnloadLevel() and allow Unity to automatically unload the scene?

AR crashes after returning from another scene

November 10, 2015 - 2:51pm #14

Thanks that was helpful, I am using Application.UnloadLevel() and that seems to work well!!

The only issue is that Vuforia is now leaking memory ( about 2 megs ) every time I load it and then unload it by moving to a non Vuforia scene.

AR crashes after returning from another scene

November 10, 2015 - 12:27pm #13

Try removing the Destroy() command and just using LoadLevelAsync() to move between scenes.

AR crashes after returning from another scene

November 10, 2015 - 12:22pm #12

Loading the scene        

AsyncOperation async = Application.LoadLevelAsync ("VuforiaTestScene" );

 

Removing it by destroying a container object that contains the scene 

Destroy(VuforiaTestScene-RootGameObject);

AR crashes after returning from another scene

November 10, 2015 - 12:01pm #11

What command do you call when you leave the ImageTargets scene and what command do you call when you return to it?

AR crashes after returning from another scene

November 10, 2015 - 11:58am #10

I am using the vuforia-unity-5-0-6 package in Unity3D 5.2.2 and can load the scene with the AR no problems and then it crashes if leave the AR scene and come back.

AR crashes after returning from another scene

November 10, 2015 - 11:53am #9

Yes, I've got this implemented in a test project and have run it on multiple iOS and Android devices. I have 2 non-Vuforia scenes and the ImageTargets 5.0.5 scene and can jump between all of them.

AR crashes after returning from another scene

November 10, 2015 - 11:50am #8

Have you tested it on iOS?

The issue does not happen in the Unity3D editor and I have only seen it occur on iOS based devices.

Best regards

Stephan

AR crashes after returning from another scene

November 10, 2015 - 11:43am #7

I'm not having any problems navigating between Vuforia and non-Vuforia scenes. I am using:

Application.LoadLevelAsync("Vuforia-ImageTarget");

AR crashes after returning from another scene

November 10, 2015 - 10:02am #6

Its interesting that even the vuforia image target example exhibits this behavior.  Has any been able to get around this?

 

AR crashes after returning from another scene

November 9, 2015 - 6:40pm #5

You may want to register for Vuforia notification callbacks and make sure that AR init code has finished before trying to access the camera:

http://developer.vuforia.com/library/resources/api/unity/class_vuforia_1_1_vuforia_abstract_behaviour

 

AR crashes after returning from another scene

November 9, 2015 - 3:42pm #4

This worked on Vuforia 4, does not fix it in Vuforia 5 in the current app I am working on.

 

AR crashes after returning from another scene

November 9, 2015 - 9:29am #3

TomH

Did you manage to fix this issue? I'm facing an exactly identical problem!

Thanks!

AR crashes after returning from another scene

August 13, 2015 - 4:35pm #2

If you are wanting to persist the ARCamera across scenes you can use the "Keep AR Camera Alive" option on the ARCamera. If you are wanting to quit the ARCamera tracking, you might try calling Stop() and Deinit() on the CameraDevice before leaving the scene.

Log in or register to post comments