猴子原創,歡迎轉載。轉載請註明: 轉載自Cocos2Der-CSDN,謝謝!
原文地址: http://blog.csdn.net/cocos2der/article/details/44133127
今天運行一個場景時候,welcome場景可以旋轉,進入主場景後發現只要旋轉手機屏幕就會crash。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'UnityDefaultViewController should be used
only if unity is set to autorotate'
出錯信息已經顯示是使用auto rotation導致的。
Unity Build setting裏面已經是Auto Rotation,爲何主場景無法旋轉?
而且錯誤表示:是我在調用autorotate,但是我設置的模式卻不是autorotate。
最後全局搜索了下,果然有測試代碼手工設置了屏幕方向爲Left。修改爲自動後,問題解決。
Screen.orientation = ScreenOrientation.AutoRotation;
問題雖然是個小問題,但是想起了那誰誰前天線上遊戲由於開發寫的測試代碼跑到線上,導致玩家多了一個裝了很多道具的寶箱。
所以,誰要是說:”這個功能先這樣就好了, 等正式配置出來了,我在修改。“,我保證不掐死你…