- Home /
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'd like to bump this because I'm running into the same problem. WebCamTexture seems to work fine on my laptop webcam, but I get solid black when running on my $$anonymous$$otorola Droid 2 (running Android 2.3.4)
I'm also having the same issue on half the Android devices I check the webCamTexture on.
Answer by casimps1 · Sep 04, 2012 at 02:31 PM
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.