Unity Android with Front Camera WTF bug

I am developing an Android application using Unity. Tries to use the front camera, receiving data from WebCamTexture. The back side works fine, but when I try to flip the camera, this terrible thing comes out:

**bitstream == (int)0xAFAFAFAF

like an error in unity console. Then WebCamTexture stops working in ALL, even with the rear camera. Any idea?

PS using Unity 5.3.3p1 ... maybe a Unity bug?

+4
source share
2 answers

Note

for all readers, a new plugin has appeared for Unity (2016),

https://www.assetstore.unity3d.com/en/#!/content/52154

" ", Unity.

- - Unity - -. Unity, , , .

. , , , . , 2-3 , .


!

public void CycleCams()
        {
        StartCoroutine(_cycle());
        }

    private IEnumerator _cycle()
        {
        WebCamDevice[] d = WebCamTexture.devices;
        if ( d.Length <= 1 )
            {
            Debug.Log("only one.");
            if (d.Length==1) Debug.Log("Name is " +d[0].name);
            yield break;
            }

        Debug.Log("0 " +d[0].name);
        Debug.Log("1 " +d[1].name);

        if ( wct.deviceName == d[0].name )
            {
            wct.Stop();
            yield return new WaitForSeconds(.1f);
            wct.deviceName = d[1].name;
            yield return new WaitForSeconds(.1f);
            wct.Play();

            nameDisplay.text = "\"" +wct.deviceName +"\"";
            yield break;
            }

        if ( wct.deviceName == d[1].name )
            {
            wct.Stop();
            yield return new WaitForSeconds(.1f);
            wct.deviceName = d[0].name;
            yield return new WaitForSeconds(.1f);
            wct.Play();

            nameDisplay.text = "\"" +wct.deviceName +"\"";
            yield break;
            }
        }
+6

Android- , . - , , , , - , . Marshmallow, - , . Java Unity.

+3

All Articles