- Home /
Use one webcamtexture on multiple gameobject
I was trying This Code to map Theta S camera to the sphere.
Like this, there is two half-sphere. The mapping is done by shaders, so I don't have to care about this. Both piece of sphere has same code:
public int cameraNumber = 0;
private WebCamTexture webcamTexture;
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
if (devices.Length > cameraNumber) {
webcamTexture = new WebCamTexture(devices[cameraNumber].name, 1280, 720);
GetComponent<Renderer>().material.mainTexture = webcamTexture;
webcamTexture.Play();
} else {
Debug.Log("no camera");
}
}
What's the problem is, only "sphere1" renders WebCamTexture. I tested with additional test plane, and only the plane rendered WebCamTexture. (Both spheres didn't).
It seems only one gameobject can render one WebCamTexture. How can I render one WebCamTexture on multiple gameobject?
I already tried This and This, but both didn't work.
In This Page, it suggested a solution in one-line: Which I couldn't understand. Can anyone help me?
Your answer
Follow this Question
Related Questions
Web Cam Texture on UI Panel 0 Answers
Could not connect pins - RenderStream() UnityEngine.WebCamTexture:Play() 0 Answers
How to simultaneously render multiple (web)cam streams in Android 1 Answer
How do I adjust the brightness, color and contrast using a slider? 0 Answers
,iOS WebCamera Texture GetPixels() call returns only black colours? 1 Answer