- Home /
Webcam Unity 3.5 not working on Android?
With Unity 3.5, I've got live camera input working on the desktop (MacBook Pro) and iOS (iPhone4), but on both my Android phones (LG Optimus and Samsung Galaxy Nexus) I get zip.
Here's my script, attached to a plane with a RenderTexture:
#pragma strict
private var devices : WebCamDevice[];
public var deviceName : String;
private var wct : WebCamTexture;
private var resultString : String;
function Start() {
yield Application.RequestUserAuthorization (UserAuthorization.WebCam | UserAuthorization.Microphone);
if (Application.HasUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone)) {
devices = WebCamTexture.devices;
deviceName = devices[0].name;
wct = new WebCamTexture(deviceName, 640, 480, 30);
renderer.material.mainTexture = wct;
wct.Play();
resultString = "no problems";
} else {
resultString = "no permission!";
}
}
function OnGUI() {
for (var i = 0; i < devices.length; i++) {
GUI.Box(Rect(100, 100+(i*25), 300, 25),devices[i].name);
}
GUI.Box(Rect(100, 100+(i*25), 400, 25),resultString);
}
Any ideas?
Just want to 2nd this, have the same problem on: Samsung Galaxy Nexus (android os v4.0.1) But works well on: Samsung Nexus S (android os v2.3.4) Sony Ericsson Xperia Play (android os v2.3.4) Sony Ericsson Xperia $$anonymous$$ini (android os v2.3.4) Is it a hardware or os version related issue?
There's been some activity on this thread: http://forum.unity3d.com/threads/123732-Webcam-on-Android-not-working/
but no answers yet - very frustrating.
Don't think it's simply hardware or os version - here's what's been reported so far here & on the forum thread:
Works on: Samsung Nexus S (v2.3.4) Sony Ericsson Xperia Play (v2.3.4) Sony Ericsson Xperia $$anonymous$$ini (v2.3.4) Toshiba AT100 (v3.1)
Doesn't work on: Samsung Galaxy Nexus (v 4.0.1) LG Optimus Thrill 4G (v2.3) Asus Eee Transformer TF-101
I'd like to bump this as well... works on my laptop webcam, but I get solid black on Android