Search Issue Tracker

Fixed in Unity 5.2.2

Votes

9

Found in

5.2.0f2

Issue ID

724480

Regression

Yes

[iOS] WebCamTexture.width/height always returns 16

iOS

-

-

Priority: 7Not yet prioritized for a release

-

Severity: 2Core functionality majorly impacted

WebCamTexture.width/height always returns 16 on iOS. Although the actual resolution of the WebCamTexture is clearly higher than that, it returns 16x16.

This issue seems to be a regression from 5.1.

Comments (4)

  1. C21e411b3d128a434d50ed81edb09679?d=mm

    Corona

    Dec 18, 2015 05:47

    I use version 5.2.1f and "KRUEGERT" solution solves this problem. thanks very much.

  2. Cc4ef4c64a7cfef20c1d01a31066be8c?d=mm

    KruegerT

    Nov 18, 2015 15:16

    We still have this bug in Unity 5.2.1f1 but only the first time we initialise the camera. I got around it by using this code:

    if(wTex.width <= 16){
    while(!wTex.didUpdateThisFrame){
    yield return new WaitForEndOfFrame();
    }
    wTex.Pause();
    Color32[] colors = wTex.GetPixels32();
    wTex.Stop();

    yield return new WaitForEndOfFrame();

    wTex.Play();
    }

  3. 8c120e7335a5129f19ebb1e35d64e8da?d=mm

    frg_kova

    Sep 22, 2015 21:53

    It used to be 16x16 for few frames without needing to call anything on the texture, in 5.2.0 that workaround stopped working. I'll try your advice and insert GetPixels32() also, but that's so much waste of memory...

  4. 16ac0964d997a183b8239a32f103de6d?d=mm

    Bunderant

    Sep 18, 2015 16:26

    We found a temporary workaround for this. In our init coroutine, as soon as "didUpdateThisFrame" was true, we would initialize anything dependent on the size of the WebCamTexture. The size now was always sixteen by this point, but as soon as some operations were called on the texture, specifically GetPixels32(), the size would go back to our originally requested size. So, we added this to our init coroutine:

    if (webCameTex.didUpdateThisFrame) {
    Color32[] colors = null;
    while (webCamTex.width <= 16) {
    colors = webCamTex.GetPixels32();
    yield return new WaitForEndOfFrame();
    }
    // Do your init stuff
    }

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.