diff --git a/Assets/Scripts/CameraManager.cs b/Assets/Scripts/CameraManager.cs index 0504a68..511ec47 100644 --- a/Assets/Scripts/CameraManager.cs +++ b/Assets/Scripts/CameraManager.cs @@ -10,6 +10,7 @@ public class CameraManager : MonoBehaviour public Button resumeButton; public RawImage photoBox; private Texture2D photo; + private int numberOfWebcams; // Start is called before the first frame update void OnEnable() @@ -26,6 +27,7 @@ void OnDisable() void Start() { wDevice = WebCamTexture.devices.FirstOrDefault(x => x.isFrontFacing == false); + numberOfWebcams = WebCamTexture.devices.Count(); } // Update is called once per frame @@ -126,7 +128,7 @@ public Texture2D GetPhoto() return photo; } - if (!wTexture || WebCamTexture.devices.Count() < 1) + if (!wTexture || numberOfWebcams < 1) { return null; }