Last active
April 18, 2020 13:44
-
-
Save rkandas/9a7e62ea2fe6119d03dcbcaf6dc9ce26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
public class WebCamPlayer : MonoBehaviour | |
{ | |
[SerializeField] public RawImage rawimage; | |
private WebCamTexture webcamTexture; | |
void Start () | |
{ | |
if (rawimage != null) | |
{ | |
webcamTexture = new WebCamTexture(1080,1920,30); | |
rawimage.texture = webcamTexture; | |
rawimage.material.mainTexture = webcamTexture; | |
webcamTexture.Play(); | |
} | |
else | |
{ | |
Debug.LogError("RawImage not set"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment