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?

1 Comment

Hi, 


I attached the scripts to the Canvas GameObjects in the "Image Tracking - Simple" and the "Instant Tracking - Simple" scenes from the example project, but couldn't reproduce the crash.

Can you still reproduce the issue? If so, can you please provide more information about the issue, or send us a sample project that reproduces the issue?


Thank you,

Alexandru

Login or Signup to post a comment