fix: camera issue when no camera
This commit is contained in:
parent
c0d6aaef98
commit
e43ecb338f
@ -31,11 +31,14 @@ void Start()
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (wTexture)
|
Texture2D texture = GetPhoto();
|
||||||
|
|
||||||
|
if (texture)
|
||||||
{
|
{
|
||||||
photoBox.texture = GetPhoto();
|
photoBox.texture = texture;
|
||||||
Resources.UnloadUnusedAssets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Resources.UnloadUnusedAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WebcamResume()
|
public void WebcamResume()
|
||||||
@ -123,7 +126,7 @@ public Texture2D GetPhoto()
|
|||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wTexture)
|
if (!wTexture || WebCamTexture.devices.Count() < 1)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user