Last Updated
On this page, I’ll explain how to display the second screen. You can also try it out with the sample included in the Plugin.
Caution
Dual-screen display does not function in Unity Editor. Please Build and run your app to confirm.
Prerequisites
-
Setup your Spatial Reality Display, if not, see: Setup Spatial Reality Display, Setup Spatial Reality Display Settings
-
Set up your Unity project installed SRDisplay UnityPlugin, if not, see: Set up for Unity
How to Display the Second Screen
Refer to Create your simple app "Hello cube!" to place the SRDisplayManager Prefab.
To display the second screen, first call Init2DView() on the SRDisplayManager. Then, obtain Spatial Reality Display2DView.
if (_Spatial Reality DisplayManager.Init2DView())
{
_Spatial Reality Display2DView = _Spatial Reality DisplayManager.Spatial Reality Display2DView;
}
Use Show(true) to display the second screen.
_Spatial Reality Display2DView.Show(true);

To hide the second screen, set it to false.
_Spatial Reality Display2DView.Show(false);

In the sample, the F5 key is assigned for toggling display/hide of the second screen.
How to display the Second Screen in Full Screen
You can display the second screen in full screen.
_Spatial Reality Display2DView.SetFullScreen(true);

To revert from full screen, use:
_Spatial Reality Display2DView.SetFullScreen(false);
In the sample, you can check this using the F6 key (toggle full screen).
How to Set Images for the Second Screen
You can configure images for display, including left-eye images, right-eye images, and mixed images on the Spatial Reality Display.
Set the left-eye image.
_Spatial Reality Display2DView.SetSourceTexture(Spatial Reality DisplayTextureType.LeftEye);
Set the right-eye image.
_Spatial Reality Display2DView.SetSourceTexture(Spatial Reality DisplayTextureType.RightEye);
Set the mixed image.
_Spatial Reality Display2DView.SetSourceTexture(Spatial Reality DisplayTextureType.SideBySide);
ELF-SR2:

ELF-SR1:

In the sample, you can switch between the texture types using the F7 key.
Set a custom texture.
Starting from SDK 2.4.0, you can also display the texture of your choice (CustomTexture)。
To display a custom texture, call SetSourceTexture() with the Spatial Reality DisplayTextureType.Custom parameter, and assign the texture you want to display to CustomTexture.
For example, if you want to place a camera in the scene and display the image from that camera on the Second Screen, your implementation might look like this:
public void ShowCameraImage(Camera sourceCamera)
{
_Spatial Reality Display2DView.SetSourceTexture(Spatial Reality Display2DView.Spatial Reality DisplayTextureType.Custom);
_Spatial Reality Display2DView.CustomTexture = sourceCamera.activeTexture;
}

See Sample 6 for an example of how to use CustomTexture.