Hello,
I have made several apps on my Android device with ARFoundation. We recently got some Microsoft Surface Pro 7s and I am tasked with converting the Android AR apps to these tablets. I know that they run Windows 10 and I haven’t had any issues getting them to build and run on the tablets.
My issue is this: I cannot get the built-in webcam to work while running the built app. My UI shows up and works, but the AR features do not since the camera is just black. The light actually comes on near the cameras since I changed some of the Project Settings to allow Webcam, microphone, etc. but nothing from the camera is displayed on the screen.
My questions:
- Does AR Foundation even work with Windows 10?
- If it doesn’t work with W10, what should i be using? I believe it is capable of AR (unity3d - Windows Mixed Reality for Surface App - Stack Overflow). From other research i believe it is, but i could be wrong of course.
- Am I just not enabling the camera properly (see code below)?
- Is there something wrong with my scene setup that is not allowing it (aka wrong camera or something)?
I have looked at some other forums but haven’t found anything too different from the code below that works. Here is what i have been using just trying to test out the camera functionality:
private static WebCamTexture webCam;
private void Awake()
{
WebCamDevice[] devices = WebCamTexture.devices;
int cameraIndex = 0;
if (devices.Length == 0)
{
return;
}
foreach (WebCamDevice cam in devices)
{
if (cam.isFrontFacing)
{
webCam = new WebCamTexture(cameraIndex, Screen.width, Screen.height);
webCam.deviceName = cam.name;
webCam.Play();
}
}
}
I have also tried a bit of code that allows me to see the camera’s output as a texture on a RawImage or other objects, but it just overlays the UI and it also doesn’t even detect the ground and such. This is not what i do on my Android AR apps so i figured it wasn’t the right approach either. I can show that code if it actually is the right path.
Any guidance would be appreciated.