I am trying to render my webcam on a texture, for that I am using the following unity code:
WebCamTexture webcamTexture = new WebCamTexture();
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
But unity keeps crashing. I have tried it with different unity versions (2022.3.48),(2022.3.45), (2021.3.8)
and different PCs as well, but its the same. I am using windows 11 and have tried to make builds as well but the issue remains.
Can someone help?