Assets/Watson/Scripts/Widgets/WebCamWidget.cs
/// <summary>
/// Switches WebCamDevice to the next device.
/// </summary>
Switches WebCamDevice to the next device.
Switches WebCamDevice to the next device .
public void SwitchWebCam()
        {
            WebCamDevice[] devices = Devices;
            if (devices.Length == 0)
                throw new WatsonException(string.Format("There are no WebCam devices!"));
            if (devices.Length == 1)
            {
                Log.Warning("WebCamWidget", "There is only one WebCam device!");
                return;
            }
            m_WebCamTexture.Stop();
            int requestedIndex;
            if (m_WebCamIndex == devices.Length - 1)
                requestedIndex = 0;
            else
                requestedIndex = m_WebCamIndex + 1;
            m_WebCamTexture.deviceName = devices[requestedIndex].name;
            m_WebCamIndex = requestedIndex;
            Log.Status("WebCamWidget", "Switched to WebCam {0}, name: {1}, isFontFacing: {2}.", m_WebCamIndex, devices[m_WebCamIndex].name, devices[m_WebCamIndex].isFrontFacing);
            m_WebCamTexture.Play();
        }
public void SwitchWebCam ( ) { WebCamDevice [ ] devices = Devices ; if ( devices . Length == 0 ) throw new WatsonException ( string . Format ( " " ) ) ; if ( devices . Length == 1 ) { Log . Warning ( " " , " " ) ; return ; } m_WebCamTexture . Stop ( ) ; int requestedIndex ; if ( m_WebCamIndex == devices . Length - 1 ) requestedIndex = 0 ; else requestedIndex = m_WebCamIndex + 1 ; m_WebCamTexture . deviceName = devices [ requestedIndex ] . name ; m_WebCamIndex = requestedIndex ; Log . Status ( " " , " " , m_WebCamIndex , devices [ m_WebCamIndex ] . name , devices [ m_WebCamIndex ] . isFrontFacing ) ; m_WebCamTexture . Play ( ) ; }
Switches WebCamDevice to the next device.
Switches WebCamDevice to the next device .