I was trying to see how Defold could handle different resolutions on different devices. But it seems that the engine picks only the top qualifier on the list?
I setup a simple test project to show this, here is the compressed file: Mobile game.zip (414.4 KB)
I deployed and tested on an iPhone 14 and iPad Air 4.
On the iPhone the portrait/landscape layouts look like this:
It seems there is a misunderstanding of how the system works.
You create multiple profiles, each representing a virtual coordinate space that is applied based on specific qualifiers. The first qualifier defines the virtual space size. The engine selects the closest qualifier according to Defold’s dynamic profile selection. Once the engine selects a profile, it applies all the overrides from the GUI file associated with that profile.
You can specify a separate profile for each screen size, but it’s not mandatory. The engine operates using a virtual profile space, which is then mapped onto the real space using the rules specified in the nodes. For example, if the selected profile includes a zoom on the background, it will adjust according to the screen size, etc.
You have one virtual coordinate space set to 1920x1080, and you design your interface according to this profile. This profile will be applied if one of its qualifiers fits better than all other available qualifiers. The engine picks the most suitable profile based on the defined qualifiers, ensuring that the interface is adjusted to match the best possible virtual space for the given screen size.
Thank you for the very detailed update So if I understand correctly, defining the model device name (i.e iPad13,1) doesn’t really matter as the engine will pick the qualifier with lowest score from this formula:
So just for testing I setup 2 qualifiers for the landscape profile:
and deployed on the iPad air 4 (which has physical resolution 2360x1640) so the second qualifier on the list should be picked right? As it scores 0…
But I think it’s still picking the first qualifier (the 1280x720 one).
Btw, how can I get from code the current virtual resolution picked by the engine?
Each profile is tied to a single virtual resolution. You can specify as many qualifiers as needed, but all of them will use the resolution defined in that profile.
In your example, even if you have one or multiple qualifiers for Landscape, this profile will be selected based on your setup. When you have only two profiles, like Portrait and Landscape, there’s generally no need to have more than one qualifier per profile. However, if you want to have two distinct Landscape profiles, it’s likely that multiple qualifiers will be necessary to handle different cases.
If you want to create two distinct interfaces for resolutions such as 1280x720 and 2360x1640, you will need to create two separate profiles for those specific resolutions. Each profile will handle its own virtual space based on the screen size and the rules set in the qualifiers.
Another question related to this topic … what would be the best approach if I wanted my game to always in portrait orientation on phones, but in landscape on tablets?