Unity WebCamTexture restart

I’m initializing with this code:

WebCamDevice[] devices = WebCamTexture.devices;
string deviceName = devices[0].name;
WebCamTexture wct = new WebCamTexture(deviceName, Constants.BACKGROUND_WIDTH * 2, Constants.BACKGROUND_HEIGHT * 2, 20);
backgroundSprite.renderer.material.mainTexture = wct;
wct.Play();

And the rest of the code:

void TakeSnapshot() {
    Texture2D snap = new Texture2D(wct.width, wct.height);
    snap.SetPixels(wct.GetPixels());
    snap.Apply();

    AppManager.Singleton.SetPictureTaken(snap);
}

private void onSnapAction() {
    wct.Pause();
    TakeSnapshot();
    wct.Stop();
    DestroyObject(backgroundSprite);
    DestroyObject(wct);
}

Now when I try to reload my scene, it crashes. I’m thinking it’s because the camera doesn’t get released somehow.

I’m also using vuforia after I’ve taken a picture, but that crashes the app. However, when I’m using my front camera to take a picture and my backcamera to do imagetracking it works fine. (Until I’m accessing the camera’s again).

Thanks in advance.

Ok, so apparently the problem was iOS7, apparently their video handling is different and Unity 4.2.1 and lower hasn’t got a fix for that. Upgrading my Unity worked.

It looks like the camera didn’t get freed correct or was somehow deleted (BadAccess crash in XCode). Accessing it again would cause the crash. Unity 4.2.2. and up has a fix for this.