fix: webcam

This commit is contained in:
Michel Roux 2024-01-28 02:59:30 +01:00
parent 1e53eb3ae5
commit fd251f22a9

View File

@ -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;
}