that this is a problem that Unity can and should solve on their end. Software-only video sources, like the OBS Virtual Camera, do not use DevicePath. Relying on DevicePath seems to not be recommended,
OBS 27.2.1
Other software can be called, but Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WebCamManager : MonoBehaviour
{
// Use this for initialization
void Start () {
GetWebCam();
}
void GetWebCam(){
WebCamTexture webcamTexture = new WebCamTexture ();
#if (Unity_IOS || UNITY_ANDROID) && !UNITY_EDITOR
for (int i = 0; i < WebCamTexture.devices.Length; i++) {
if (!WebCamTexture.devices [i].isFrontFacing) {
webcamTexture.deviceName = WebCamTexture.devices [i].name;
break;
}
}
#endif
#if UNITY_EDITOR
for (int i = 0; i < WebCamTexture.devices.Length; i++) {
Debug.Log(WebCamTexture.devices[i].name);
if(WebCamTexture.devices[i].name != null){
webcamTexture.deviceName = WebCamTexture.devices[i].name;
}
}
#endif
Renderer _renderer = this.GetComponent<Renderer>();
_renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
}
The old solution:
OBS 25
Release OBS-VirtualCam 1.2.1 · CatxFish/obs-virtual-cam (github.com)
- Remove dummy device path to avoid conflict with Skype desktop
If you want to use obs-virtualcam with Unity-base application , please use reg_path.reg to manually add dummy device .