Reputation: 11
In Unity, I'm using WebCamTexture (discussed here: Display live camera feed in Unity)
But it seems WebCamTexture can only detect physical webcams, but how to do you make it use virtual webcams?
I want to use a virtual webcam such as OBS (https://obsproject.com/welcome) or any other "virtual camera" video stream, how can you select this for WebCamTexture?
I've tried but only Physical camera are detected, I can't figure out how to detect virtual cameras.
List and print out the connected devices it detects:
var devices : WebCamDevice[] = WebCamTexture.devices;
for( var i = 0 ; i < devices.length ; i++ )
Debug.Log(devices[i].name);
Connect to an attached webcam and send the image data to a texture:
WebCamTexture webcam = WebCamTexture("NameOfDevice");
renderer.material.mainTexture = webcam;
webcam.Play();
But it cannot find "virtual camera streams"....
Upvotes: 1
Views: 907
Reputation: 5035
the mechanism to do it with a virtual camera is called RenderTexture. instead of creating it with code you can create an asset manually in the editor, assign it to the camera and assign it to the material
Upvotes: 0