I was wondering how to approach to have both orientations (landscape and portrait) in one project, so that they would be applied accordingly to different platforms. For example, in a web top-down space shmup game: landscape on desktop and portrait on mobile. Another example would be a mobile, portrait game that should have a desktop demo. Should we keep two codebases for that?
As far as I know, game orientation is being decided on the base of display settings in game.project → depending on which is bigger: display height or width. But we cannot alter these settings in runtime (which is understood). I also think display layouts don’t help here
Actually, my story was such, that I wanted to release on itch.io a demo of a portrait mobile game and had to keep two codebases for this which got hairy later. Any ideas on how to avoid it?
Dynamic orientation should in general work out of the box. Make sure the Dynamic Orientation checkbox in game.project Display settings is checked. If checked the width and height will flip values when orientation changes.
It’s not exactly what I wanted, because with Dynamic Orientation the game could be played in both orientations on mobile, and I wanted to lock it in Portrait (for mobile). I want the orientation to be dependant on the platform.
When using bob.jar to build the game (locally or on CI), you can specify more than one settings file. It allows you to apply android specific settings depending on feature
Thank you both for the answers. I like especially the Bob path, as it seems like a real solution to this. As an afterthought, I realized also, that I can change manually these two fields in settings if I found Bob too daunting. Looks like there’s no problem anymore.