Access dual-screen info from Unity

Important

This article describes functionality and guidance that is in public preview and may be substantially modified before it's generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.

After following the instructions to install the Surface Duo SDK, use these methods to adapt games for the Surface Duo:

  • DeviceHelper.IsDualScreenDevice – Call this method before accessing other dual-screen APIs.
  • ScreenHelper.GetCurrentRotation – Get the current rotation value (eg. 0 means 0 degrees, 1 means 90 degrees, 2 means 180 degrees, 3 means 270 degrees).
  • ScreenHelper.IsDualMode – Whether the app is spanned across both screens (and therefore the viewport is partially obscured by the gap between screens).
  • ScreenHelper.GetScreenRectangles – Returns the dimensions of the two screens (in pixels).
  • ScreenHelper.GetHinge – Returns the dimensions of the obscured area of the viewport (in pixels). If the app is not spanned (only showing on a single screen), this will return zero-dimensions since nothing is being obscured.

View sample code for these methods in the Unity ScreenHelper sample. The sample displays device information, as shown in the screenshot below:

Unity game sample showing screen data)