Hi Guys,
i’m playing around with the webcamtexture on Android and maybe found a unity bug. But before posting a bugreport, i’d like to ask you guys if it’s realy a bug or maybe is there maybe a workaround.
first problem:
WebCamTexture crashes on Pause call
I created a Webcamtexture with name.
frontCameraTexture = new WebCamTexture(frontCameraDevice.name);
If i call now the ‘Pause’ method on the instance the App crashes with sigsegv and the stacktrace contains a message that it crashes on the native pause call on webcamtexture.
.../libunity.so ((WebCamTexture::Pause()+29)...
Normally that is not a real problem, because i could only use the Start()/Stop() combination of the WebCamtexture and destroy it after using, but that leads me to the second problem.
second problem:
Internal(native) Pause method is automatically called if app goes to background(home key press)
If the User moves the app to the background while a scene with a WebCamTexture is active the engine triggers the internal Pause method of the WebCamTexture with is causing the crash. It is also triggerd if a new scene is loaded and the old one unloads.
additionally infos:
Unity: 5.5.0.f3 Personal
tested on android simulator and real device(samsung)
The WebCamTexture has not to be started to trigger the crash, it’s enough to create an instance in the scene.
Also i could workaround the new scene loading crash. Before loading the new scene i called the Stop method and destroyed the webcamtexture, than wait some time (coroutine yield…) before loading the new scene. It looks like the engine need some time to cleanup the texture. After destroying the texture the crash is not triggerd while unloading the scene.
But i could not workaround the crash if the user moves the app to the background. I tried to use OnApplicationPause/OnApplicationFocus, but i looks like they run not long enougth to let the engine destroy the texture completely.
Is there a workaround for the Problems or is it a bug in the engine that has to be fixed?
maybe it’s related to bug
a note:
after additional research - it looks like it is a bug so i created a bugreport