I have read a lot of examples about taking screenshots in Unity3D, but they all explain "in-game" screenshots. I would like to take a screenshot of an application window on my desktop and paint it onto a GameObject as a texture.
Any idea how I can go about doing this? I've only used Unity3D a few times and so would appreciate some guidance on if this is possible or not and how I might achieve this.
I know that I can write some regular C# application that will capture the outputs of windows to file and read the images in Unity3D. However, I would prefer not to write to disk.
At the moment, all I am able to do is get an "in-game" screenshot...
void LateUpdate()
{
//I know that I could load an image from file here...
Texture2D tex = new Texture2D(Screen.width, Screen.height);
tex.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
tex.Apply();
display.material.mainTexture = tex;
}