

A common issue in mobile Unity projects happens when rotating the device causes the app to freeze, restart, lose references, or even crash completely. Many developers describe this as a “Unity Android orientation bug.”
In reality, screen rotation on Android can trigger complex lifecycle changes. If your project is not prepared for those changes, problems appear quickly.
This article explains why screen rotation can cause crashes and how to prevent orientation-related issues in Unity Android builds.
On Android, changing device orientation may cause the activity to restart. When that happens:
If your code assumes the app never reloads, crashes can happen.
By default, Android may destroy and recreate the activity when orientation changes.
This means your Unity app can partially restart.
Symptoms include:
If you use a singleton pattern like this:
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
}
Orientation-based restarts can cause unexpected duplicate creation if not handled carefully.
Sometimes the original instance still exists, and the system attempts to create another.
If your project uses:
These plugins may not handle orientation changes correctly and crash during reinitialization.
After rotation, UI may:
This is usually caused by incorrect Canvas scaling settings.
If your game does not require rotation, disable it.
Go to:
This is the simplest and safest solution.
If rotation is required:
Reducing allowed orientations reduces unexpected transitions.
You can detect screen size changes:
void Update()
{
if (Screen.width != lastWidth || Screen.height != lastHeight)
{
Debug.Log("Screen size changed");
lastWidth = Screen.width;
lastHeight = Screen.height;
}
}
This allows you to refresh UI or reposition elements safely.
Set Canvas Scaler to:
This prevents layout breaking during rotation.
If orientation restarts the activity, heavy initialization inside Awake can cause crashes or long freezes.
Move expensive initialization to controlled startup logic instead.
Orientation behavior differs between devices and Android versions. Always test rotation on multiple real devices.
In advanced cases, you can modify the Android manifest to control configuration changes manually.
This prevents activity recreation on rotation.
However, this requires custom Android configuration and should only be done if necessary.
If your app crashes on rotation:
Many orientation crashes are plugin-related rather than Unity engine issues.
Usually not. Android lifecycle behavior is responsible for most orientation problems. Unity responds to those system-level changes.
Crashes happen when scripts or plugins are not prepared for activity recreation.
The Unity Android orientation “bug” is usually a lifecycle management issue. Screen rotation can restart or reconfigure the app, which breaks poorly structured systems.
By controlling orientation settings, structuring singletons safely, and testing on real hardware, you can eliminate most crashes related to rotation.
Understanding Android’s behavior is key to building stable Unity mobile applications.