Screen orientation manual change

Hello. I’m experiencing serious issues with the application and interface freezing when changing the orientation from within the app. Some screens need to be in portrait orientation, while the main orientation is set to landscape. I’m changing the orientation using “Screen.orientation =”. Most of the time, the device orientation changes successfully and quickly, but there are instances when the screen freezes and becomes unresponsive. Has anyone else encountered this? I’ll provide my settings below.

content.Q<Button>("ChangeOrientation").RegisterCallback<ClickEvent>(OnChangeOrientation);
private void OnChangeOrientation(EventBase evt)
        {
            UnityEngine.Screen.orientation = UnityEngine.Screen.orientation == ScreenOrientation.Portrait ? ScreenOrientation.LandscapeLeft : ScreenOrientation.Portrait;
            Debug.Log(this, $"OnChangeOrientation -> {UnityEngine.Screen.orientation}");
        }


I found this tracker marked as “resolved,” but I couldn’t find the solution.