---
title: SwapchainPreTransform
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform.md
last_updated: 2026-11-10
generated_at: 2026-11-12T00:25:06.493Z
locale: en-us
---

# SwapchainPreTransform

> The rotations that Unity can apply during rendering to match the native orientation of the device's display panel.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine.Rendering](/engine/7000.0/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public enum SwapchainPreTransform
```

## Remarks

On devices that support pre-rotation, Unity can render each frame to the backbuffer already rotated to the native orientation of the display panel. This saves the operating system from rotating the image again before it displays it. Use [Screen.currentSwapChainPreTransform](/engine/7000.0/script-reference/unityengine/screen/currentswapchainpretransform.md) to find out which rotation Unity applies in the current frame. For more information, refer to [Framebuffer orientation](/engine/7000.0/manual/platform-specific/android/developing/graphics/vulkan-swapchain-pre-rotation.md).

Each value is relative to the native orientation of the display panel, not to portrait or landscape. For example, a landscape app reports a 90-degree or 270-degree rotation on most phones, but no rotation on most tablets. Don't use these values to detect the screen orientation. Use [Screen.orientation](/engine/7000.0/script-reference/unityengine/screen/orientation.md) instead.

Each value matches a Vulkan surface transform (`VkSurfaceTransformFlagBitsKHR`). Vulkan defines these rotations as clockwise rotations of the image content.

A 90-degree or 270-degree rotation swaps the width and height of the native backbuffer relative to [Screen.width](/engine/7000.0/script-reference/unityengine/screen/width.md) and [Screen.height](/engine/7000.0/script-reference/unityengine/screen/height.md). Unity adjusts the C# API, viewports, and scissor rectangles for you. You only need to handle the rotation yourself if you write directly to the backbuffer, for example from a native rendering plug-in, or in shaders that don't use Unity's projection matrix.

Additional Resources: [Screen.currentSwapChainPreTransform](/engine/7000.0/script-reference/unityengine/screen/currentswapchainpretransform.md), [SystemInfo.supportsSwapChainPreTransform](/engine/7000.0/script-reference/unityengine/systeminfo/supportsswapchainpretransform.md), [QualitySettings.disableSwapChainPreTransform](/engine/7000.0/script-reference/unityengine/qualitysettings/disableswapchainpretransform.md).

## Examples

```csharp
// Attach this script to a GameObject in a scene.
// This example logs the pre-rotation that Unity applies whenever it changes, for example when the user rotates the device.
using UnityEngine;
using UnityEngine.Rendering;

public class PreTransformLogger : MonoBehaviour
{
    SwapchainPreTransform m_LastPreTransform;

    void Start()
    {
        if (!SystemInfo.supportsSwapChainPreTransform)
            Debug.Log("This device doesn't support pre-rotation, so the pre-transform is always SwapchainPreTransform.Identity.");

        m_LastPreTransform = Screen.currentSwapChainPreTransform;
        Debug.Log("Initial pre-transform: " + m_LastPreTransform);
    }

    void Update()
    {
        SwapchainPreTransform preTransform = Screen.currentSwapChainPreTransform;
        if (preTransform == m_LastPreTransform)
            return;

        m_LastPreTransform = preTransform;

        // A 90-degree or 270-degree rotation swaps the width and height of the native backbuffer.
        bool swapsWidthAndHeight = preTransform == SwapchainPreTransform.Rotate90
            || preTransform == SwapchainPreTransform.Rotate270;

        Debug.Log("Pre-transform changed to " + preTransform + ". Native backbuffer width and height swapped: " + swapsWidthAndHeight);
    }
}
```

## Fields

| Value                                                                                                 | Description                                                                                            |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [Identity](/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform/identity.md)   | No rotation. The rendered image already matches the native orientation of the display panel.           |
| [Rotate180](/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform/rotate180.md) | Unity rotates rendering by 180 degrees to match the native orientation of the display panel.           |
| [Rotate270](/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform/rotate270.md) | Unity rotates rendering by 270 degrees clockwise to match the native orientation of the display panel. |
| [Rotate90](/engine/7000.0/script-reference/unityengine/rendering/swapchainpretransform/rotate90.md)   | Unity rotates rendering by 90 degrees clockwise to match the native orientation of the display panel.  |
