The UI works well in both mobile web and AR mode now, and stays the same size. It’s an issue with the render size in AR (that we cannot really control). I might add this code to the XR implementation so that it will happen automatically, but I still need to find the right place for it
OMG! I’m also still stuck with (some other and new) mobile issues. Oh, how I just hate mobile. If you’d ask Apple, they’d say you can still make it an app. If you’d ask Apple EVERYTHING would need to go through (the amazing and unique! bloody appstore.
The UI doesn’t react to hardware scaling level, you need to implement it yourself. It seems now that that the UI stays the same size and keeps the hardware scaling level correct.
Feels like the infernal loop. I will continue to follow. I’m really very much interested in the outcome of this one. Just too bad I haven’t yet acquired enough XP to solve the bloody topic. If only I would become better at this, my life and work with mobile would become just so much easier
There are a few issues with every example. They vary, but the general gist is:
When entering and existing AR the UI changes its scale (unexpectedly) under certain conditions.
When setting scale values to the GUI, picked point is not being calculated correctly.
and a side issue:
When setting hardware scaling rate, the UI doesn’t react to it, only the scene does. So the UI gets smaller and needs to be rescaled manually. This should be automated IMO.
About your example:
Setting the scale values change the scale of the objects and sets the container as dirty (forcing it to rescale), but
(as far as I see) doesn’t force an internal resize of the texture, that will be important if you want hi res ui.
I think I am also missing the use case - we are talking about UI that works both in AR and on mobile, and should work the same, right?
AR doesn’t respect the hardware scaling rate, it has its own scaling of the XR framebuffer. What I find odd is that when getting out of XR the scaling doesn’t work as expected, and I mean to check that very soon (sadly a bit swamped at the moment). This is solved with the setTimeout I introduced in one of the PRs (probably need to wait a single frame to run the rescale).
I will debug this further. The solution we are looking for here is - highest resolution UI for both modes - mobile and AR, that looks the same and works the same. Seems reasonable
Oh, if it is AR only, setting the hardware scaling rate should not influence your scene. AR takes the entire screen area (i believe it is the image’s resolution as well), so UI is automatically “smaller”. So you need to scale it up. So what you are looking for is to stay in this resolution, but make the elements bigger. My solution with rescaling the texture will not work for you (due to problematic quality), but rescaling all elements prevents the clicks from passing to the ui elements.
The issue with scaling the container is that it is scaling the size of the container, making the elements render out of the screen. Setting the scale of the container’s children works much better -
The button seems to slide out of the screen, so I still need to understand what happens there. But the right way to go at the current state would be to scale the direct children and not the container itself.