{"id":339,"date":"2016-04-23T22:14:31","date_gmt":"2016-04-23T22:14:31","guid":{"rendered":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/?p=339"},"modified":"2016-04-25T21:24:53","modified_gmt":"2016-04-25T21:24:53","slug":"android-orientation","status":"publish","type":"post","link":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/2016\/04\/23\/android-orientation\/","title":{"rendered":"Android Orientation"},"content":{"rendered":"<p>We are using Unity to develop Android application. In the Unity, we can easily export to APK file and test it in the Android devices. However, during the development, we need native Android function in Unity.<\/p>\n<ol>\n<li>Control the Android rotation problem. we need to force to Android device landscape or vertical\u00a0mode because VR Rehearsal has 2 different mode such as Android portrait\u00a0mode and VR landscape mode. In the Unity player setting in Android part, we can control the orientation of Android device.<img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-341 aligncenter\" src=\"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/android-mode-1-300x157.png\" alt=\"android mode\" width=\"300\" height=\"157\" srcset=\"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/android-mode-1-300x157.png 300w, https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/android-mode-1.png 563w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>as you can see default setting is Auto Rotation. Based on the Android direction, it automatically change the orientation. However, in our application, sometimes we need to fix the orientation in certain scene. So we manually fix the orientation in script. In the Unity start function, we manually force to set the orientation by using script. like this way.<img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-342 aligncenter\" src=\"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/force-300x77.png\" alt=\"force\" width=\"300\" height=\"77\" srcset=\"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/force-300x77.png 300w, https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/wp-content\/uploads\/2016\/04\/force.png 480w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>as you can see first we set the orientation as a Portrait mode.and we set the false to other orientation.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are using Unity to develop Android application. In the Unity, we can easily export to APK file and test it in the Android devices. However, during the development, we need native Android function in Unity. Control the Android rotation problem. we need to force to Android device landscape or vertical\u00a0mode because VR Rehearsal has <a href=\"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/2016\/04\/23\/android-orientation\/\" rel=\"nofollow\"><span class=\"sr-only\">Read more about Android Orientation<\/span>[&hellip;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":342,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_meta":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-339","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vr-rehearsal"],"_links":{"self":[{"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/posts\/339"}],"collection":[{"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":2,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/posts\/339\/revisions\/344"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/media\/342"}],"wp:attachment":[{"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projects-old.etc.cmu.edu\/vr-rehearsal\/index.php\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}