- Home /
How to take screenshot of certain/all display(s) when using unity multi display (ie. 3 x display)?
I have made a unity project which has 3 x camera setup with different Unity UI Canvas on all displays. But now I want to have an in-game screenshot button, and I can only manage to take screenshot of one the displays. And the screenshot is always from the same display.
Platform: Windows Standalone
Unity version: 5.4.1f1
I have tried using:
Application.CaptureScreenshot();
Own coroutine function:
private IEnumerator takeScreenshot() { yield return new WaitForEndOfFrame(); int _width = Screen.width; int _height = Screen.height; int _startX = 0 int _startY = 0; Texture2D _screenShot = new Texture2D(_width, _height, TextureFormat.RGB24, false); _screenShot.ReadPixels(new Rect(_startX, _startY, _width, _height), _startX, _startY); _screenShot.Apply(); string _screenshotPath = "C:/Folder/" + "screenshot_" + m_currentScreenshot + ".jpg"; System.IO.File.WriteAllBytes(_screenshotPath, _screenShot.EncodeToJPG()); m_currentScreenshot++; yield return 0; }
These both results in the same thing. A screenshot of the one of the display (which is always the same).
In my own function I have tried to read outside of the display area by reading more data in the Rect by multiplying the screen width value by amount of the screens and by moving the _startX position by screen width. But the data I have gotten to the screenshot is only empty black data or repetition of the last pixels on the right side of the screen that has data.
I have also thought about doing render textures from all the cameras & UI's, but I haven't yet found a solution to convert render texture to ie. texture2D which doesn't include reading the data directly from the screen.
Is there any other way to capture screenshot from all the screens / or select the display that Unity takes the screenshot?
Your answer
Follow this Question
Related Questions
capturing screen shot, and showing the captured image on screen 2 Answers
Multi-display with 16 displays 1 Answer
Render to a specific video card 0 Answers