Hello,
in a previous post I found out how to make a screenshot of the game view using this code:
public class NewBehaviourScript : MonoBehaviour
{
void OnGUI()
{
if (GUILayout.Button("Capture"))
{
ScreenCapture.CaptureScreenshot("image.png");
}
}
}
Do you know how I could make in a way similar to the script shown above a simultaneously screenshot of the scene seen by both eyes? I mean something like in the picture attached.
I saw on the documentation that exists a StereoScreenCaptureMode but I don’t know how I could use it in a script, I’m new to C# coding.
It should be possible, but I’ve been fiddling with it and haven’t gotten it to work. You’d need to set up the scene’s rendering to be stereo (XR) to set the mode correctly. Sorry I can’t be more help than that (so far)…
I haven’t even seen an actual VR set yet so I don’t have any experience developing on one, but from looking at the API it looks like when you call ScreenCapture.CaptureScreenshot("image.png");
it defaults to the LeftEye mode of the “StereoScreenCaptureMode” enumeration, what an enumeration is is just a marker for the type, it’s a secondary optional argument of the ScreenCapture.CaptureScreenshot() function and if you don’t provide the optinal arguement it behaves like you say
if what I’m saying makes no sense you should learn some basic C# and coding before diving in too deep into unity, it won’t take too long and you’ll benefit a lot from it if you’re going to develop stuff.
Here is the code I used for getting a screenshot of both left and right eye:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BothEyesScreen : MonoBehaviour
{
void OnGUI()
{
if (GUILayout.Button("Capture"))
{
ScreenCapture.CaptureScreenshot("image.png", ScreenCapture.StereoScreenCaptureMode.BothEyes);
}
}
}
Before taking the screenshot you want, in the game view you have to set Left Eye, Right Eye or Both Eyes according to what you wanna get.
Hmm, I did the same, and all my screenshots look identical, even with “Both Eyes” checked in the Main Camera Inspector. When you say “game view” is that what you’re referring to?
I changed nothing in the main camera inspector. I’m referring to the game view in your unity project, as shown in the picture attached, you can choose your favourite view (left, right or both) when your project is in Play mode.