ドキュメント

Unity Engine

Download Unity

Unity Engine

currentSwapChainPreTransform

The rotation that Unity applies during rendering to match the native orientation of the device's display panel.
読み終わるまでの所要時間 2 分最終更新 21時間前

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static SwapchainPreTransform currentSwapChainPreTransform { get; }

Remarks

When pre-rotation is active, Unity renders each frame to the backbuffer already rotated to the native orientation of the display panel, so the operating system doesn't need to rotate the image again before it displays it. Use this property to find out which rotation Unity applies in the current frame. For more information, refer to Framebuffer orientation.
This value isn't a screen orientation or a device orientation. It describes the rotation of the app's window relative to the native orientation of the display panel, which differs between devices:
To find out whether the app is in portrait or landscape, use Screen.orientation. To read the physical orientation of the device, use Input.deviceOrientation.
The value is SwapchainPreTransform.Identity in the following cases, because Unity doesn't apply pre-rotation:
Unity applies pre-rotation only when it renders to the backbuffer, not when it renders to a RenderTexture. When Unity renders to the backbuffer, the shader constant
UNITY_DISPLAY_ORIENTATION_PRETRANSFORM
has the matching value.
Unity updates this value when it recreates the swapchain after the display rotates. During a rotation, this value can briefly differ from Screen.orientation.