Skip to content

Standalone player opens on the OS main display — nothing identifies which monitor the DisplayXR panel is #266

Description

@dfattal

Reported by a partner integrator (Amazon Lab126 / LeiaViewer port, internal ticket UNITY-133).

Symptom

A standalone build opens on the OS main display rather than on the DisplayXR/SR display. Setting the SR display as the Windows main display makes it launch there — i.e. the app simply follows the OS primary, with no notion of the 3D panel.

Root cause: nothing identifies which monitor the panel is

This is structural, not a small bug:

  • XR_DXR_display_info (native~/displayxr_extensions.h:21, XrDisplayInfoDXR) carries displaySizeMeters, displayPixelWidth/Height, nominal viewer position and view scales — but no desktop rect, no monitor handle, no device path. The managed mirror Runtime/DisplayXRDisplayInfo.cs reflects the same fields.
  • Even the transparent-overlay path never targets the panel: native~/displayxr_win32.c:1180 and :3137 call MonitorFromWindow(unity_hwnd, MONITOR_DEFAULTTONEAREST) — the overlay follows Unity's window, and is correct today only because Unity happens to be on the right monitor.

So the plugin currently cannot answer "where is the DisplayXR display on the desktop?".

Proposed fix (two parts)

  1. Runtime (DisplayXR/displayxr-runtime): extend XR_DXR_display_info with the display's desktop rect and/or a stable device path (\.\DISPLAY1, or the DXGI output device name). Filed separately on that repo.
  2. Plugin: once available, expose it as DisplayXRProvider.TryGetDisplayDesktopRect(...) and add an opt-in component / manifest setting that moves the player window onto that monitor at startup (SetWindowPos), before the swapchain settles.

Matching displayPixelWidth/Height against EnumDisplayMonitors is a possible interim heuristic, but it is ambiguous with two same-resolution monitors — prefer the runtime carrying the truth.

Workarounds today

  • Set the SR display as the Windows main display.
  • Screen.MoveMainWindowTo(Display.displays[i], …) (Unity 2021.2+) from app code.
  • Launch the player with -monitor N.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions