fix: webcam
This commit is contained in:
parent
1e53eb3ae5
commit
fd251f22a9
@ -10,6 +10,7 @@ public class CameraManager : MonoBehaviour
|
|||||||
public Button resumeButton;
|
public Button resumeButton;
|
||||||
public RawImage photoBox;
|
public RawImage photoBox;
|
||||||
private Texture2D photo;
|
private Texture2D photo;
|
||||||
|
private int numberOfWebcams;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
@ -26,6 +27,7 @@ void OnDisable()
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
wDevice = WebCamTexture.devices.FirstOrDefault(x => x.isFrontFacing == false);
|
wDevice = WebCamTexture.devices.FirstOrDefault(x => x.isFrontFacing == false);
|
||||||
|
numberOfWebcams = WebCamTexture.devices.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -126,7 +128,7 @@ public Texture2D GetPhoto()
|
|||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wTexture || WebCamTexture.devices.Count() < 1)
|
if (!wTexture || numberOfWebcams < 1)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user