Log in or register to post comments

WebCamTexture before Vuforia init

January 15, 2014 - 8:13am #1
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.

WebCamTexture before Vuforia init

January 16, 2014 - 5:46am #4

Upgrading my Unity worked.

That's great to hear, and thanks for keeping us updated :)

 

N

 

WebCamTexture before Vuforia init

January 16, 2014 - 3:58am #3

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.

WebCamTexture before Vuforia init

January 16, 2014 - 2:48am #2

Hi, 

Sorry, can you please take a step back and explain what the problem is and how it applies to Vuforia, before diving into any code.

At present this is unclear.

 

thanks

N

Log in or register to post comments