I wrote a plugin, that allows me to capture frames from my webcam. I want to display those in my GUI. I managed to create a texture and show it on a plane. When I use the same texture for a GUI.Box or similar the texture is not shown. Is there something special about textures in GUI that I have to know?
Here's what I do to show the texture on the plane:
void Update () {
getFrame(intPixels.AddrOfPinnedObject(), width, height);
tex.SetPixels(pixels);
tex.Apply();
}
This is the OnGUI:
void OnGUI()
{
Rect rect = new Rect(10, 10, 100, 100);
GUI.Box(rect, tex);
}
Any idea why this doesn't work?