Start a new topic

Screen orientation in Unity crashing on iOS

 Hello,


Our app uses both landscape and portrait mode.


We want to lock the orientation to either mode when going from one scene to the other.


We attached the following script to the canvas object for portrait mode:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class orientation_Portrait : MonoBehaviour {

 // Use this for initialization
 void Start () 
 {
 Screen.orientation = ScreenOrientation.Portrait;
 }
 // Update is called once per frame
 void Update () {
 }
}



We attached the following script to the canvas in the other scene object for landscape mode:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class orientation_LandscapeMonoBehaviour {

 // Use this for initialization
 void Start () 
 {
 Screen.orientation = ScreenOrientation.LandscapeLeft;
 }
 // Update is called once per frame
 void Update () {
 }
}


The scripts work fine on Android.


The app crashes when entering the instant tracking scene (portrait mode). Xcode says Wikitude is causing the crash. The screenshot is attached.


Why is this happening?

Login or Signup to post a comment