How to set up Unity for portrait Mobile development?

Hello Reader,

I have just started to build my own little game for Android and Apple mobile phones. I have attempted but I still don’t know how to adjust the screen (or camera, Canvas) orientation to portrait so that it would be suitable for these platforms.

Can someone give me a start as to how I should approach this? There are lots of different sources but no clear answer, please help.

Many thanks,

Mo

Ah ok I just made a new empty game object that holds the GameController script - I hope that is what you meant - but still the CountScore script outputs 0 to the console as the score limit. - It can't find the variable from the other script And trust me I don't take that as rude advice! It is true but I know I just needed to finish this game (kinda an OCD thing) any links to some basic tutorials? Thanks

1 Answer

1

The first thing you can do is to adjust the Game View to be in “portrait mode”. Simply click on the button next to “Display 1” on the little bar at the top of the Game View. The name of the button is “Free Aspect” by default.

Free Aspect

Here, create a new window size with the desired dimensions. Take a look at this site to get example of mobile dimensions. You camera will automatically be in Portrait mode in your scene view and game view.


Then, in the Build settings of Android and iOS, disable all the allowed orientation except “Portrait”. Now, when you build your game, the players won’t be allowed to turn the game in landscape mode.

Thanks, Hellium! You have given a very detailed and resourceful answer.

Thank you so so much!

Thanks for the detailed answer!

I have a question in unity 2019 there are no portrait landscape check boxes anymore where can I find it

I read you code again and u declared public static int limit twice!!!, thats not good! to use a static variable in c# u do this define public static int limit = 0; in script A then in script B u do this : Script_A_name.limit; U call the type not the script name u made