How to get webcam to work with UnityAndroid?

Hi All,

I know that some people have been having some issues with getting the webcamTexture to display correctly on some Android device (Just shows a black texture). I have also been having these problems and have tested it on the following devices;

HTC One X (v4.0.3) = Not working

HTC Desire S (v3.3.5) = Working

ASUS Transformer Pad300 (v4.0.3) = Not Working

Samsung Galaxy Nexus (v4.0.0) = Not Working

Samsung Galaxy S (v2.3.5) = Working

I have submitted an error report to Unity and awaiting response. But in the meantime i was wondering if there is an alternative method of using the camera on an android device?

Thanks in advance.

I’ve managed to find a workaround for this until Unity gets the WebCamTexture working properly with all Android devices.

There’s a free Augmented Reality SDK called Vuforia (previously QCAR - Qualcomm Augmented Reality). They offer a Vuforia package designed to plugin to Unity complete with some example Unity scenes. It was actually a very painless setup.

One of the scenes is called BackgroundTextureAccess. It shows you how to create a Texture2D out of the camera feed (essentially replicating WebCamTexture functionality).

So, this doesn’t use WebCamTexture at all, and the SDK includes a ton of AR features beyond just getting the cam to work, but it does seem to get the job done. WebCamTexture didn’t work on my Motorola Droid 2, but Vuforia did.

It may be worth a try.

Try the NatCam API. It’s new, and packs a lot of features that WebCamTexture doesn’t have (like flash, focus, and so on).