fix: camera issue when no camera

This commit is contained in:
Michel Roux 2024-01-28 02:48:34 +01:00
parent c0d6aaef98
commit e43ecb338f

View File

@ -31,11 +31,14 @@ void Start()
// Update is called once per frame
void Update()
{
if (wTexture)
Texture2D texture = GetPhoto();
if (texture)
{
photoBox.texture = GetPhoto();
Resources.UnloadUnusedAssets();
photoBox.texture = texture;
}
Resources.UnloadUnusedAssets();
}
public void WebcamResume()
@ -123,7 +126,7 @@ public Texture2D GetPhoto()
return photo;
}
if (!wTexture)
if (!wTexture || WebCamTexture.devices.Count() < 1)
{
return null;
}