- Home /
WebCamTexture cannot be displayed in Windows 8 tablet(HP ElitePad)
UPDATE: I've found out that the plane didn't actually disappeared, it's just it has used some garbage texture which has the same color of that of skybox(or maybe it's transparent)
Now I've used WebCamDevice to somehow make the plane to display the first "webcam's texture", though it's all black in color, which probably is a result of haven't turn on the webcam.
Clarifying: I'm trying to build an exe file to run on the target tablet(HP elitepad), but as I've mentioned above, the camera can't be turned on. That makes me to think that maybe I need to somehow build the project as Windows Store App to make the camera to be working
Hello everyone, currently I'm working on a project that involves using built-in camera to display what the camera sees. The scene in my project is a very simple setup, a Main Camera, a plane object for displaying what the built-in camera sees and a directional light. The below code is attached to the plane and works perfectly in editor.
private WebCamTexture webTEX;
void Start ()
{
webTEX = new WebCamTexture();
renderer.material.mainTexture = webTEX;
webTEX.Play();
}
But when I built and project and put it into the tablet for testing, the plane just simply disappeared.
I've tried another approach:
IEnumerator Start()
{
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone);
if (Application.HasUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone))
{
webTEX = new WebCamTexture();
renderer.material.mainTexture = webTEX;
webTEX.Play();
} else {
}
}
But still no luck.
so I've used OnGUI() to display some information for debugging:
void OnGUI()
{
GUI.Box(new Rect(10, 10, 100, 100), "hello world");
GUI.Box(new Rect(10, 120, 250, 100), webTEX.deviceName);
}
And they work perfectly fine in the editor and in the tablet. Both giving out the text "hello world" and the cameras' name.
Anyone have any idea that I can make this work? Any help would be greatly appreciated.
(My unity version is Version 3.5.7f6)
Your answer
Follow this Question
Related Questions
Dual Webcams work under Windows but not Linux 2 Answers
Live webcam stream in unity 2 Answers
Webcam Texture and Flashlite (Android) 3 Answers
Webcam with no name 3 Answers