AliciaCastillo
Topic Author
Posts: 16
Joined: 16 Apr 2024, 10:17

Sizes for mobile views in mobile Unity simulator.

08 Aug 2024, 11:06

Hello Again!

Today I come here to ask about mobile development.

So i'm working with visual studio 2022 and Unity. I've developed the desktop LoginView for our software and now I'm developing the mobile version for this View. I've created a separated XAML file for mobile version since this one has some visual changes and I've come across this issue:

When I run the Xaml file for mobile on unity i set this xaml in the noesis view and I execute the Simulator for mobile. The problem is that when I change between the diferent devices tha unity offers (from Iphone 12 to Xaomi Redmi 4 for example) I'm having diferent margin from the simulator border to my content, I'm not sure if this is something that I might be doing wrong or if this something that happens when using this emulator.

I'd like to ask if are there any examples for mobile development in unity or if you recomend using another emulator to test, also if you have any recomendations about how to manage sizes for mobile, I'm used to work with xamarin and there I used to manage sizes differentlyso maybe I'm doing something wrong.

Thanks beforehand!
 
User avatar
sfernandez
Site Admin
Posts: 3112
Joined: 22 Dec 2011, 19:20

Re: Sizes for mobile views in mobile Unity simulator.

12 Aug 2024, 13:49

Hello,

The simulator seems to be defining different resolutions and scales, and Noesis should adapt just fine. I've tried with the Login sample included in our package and it works as expected in all the simulator devices I tried.

iPhone 12 on the left vs Xiaomi Redmin 4 on the right:
login-sim.jpg
.
Make sure your xaml design is not tied to a fixed aspect ratio, or it will leave margins when the aspect ratio changes.
 
AliciaCastillo
Topic Author
Posts: 16
Joined: 16 Apr 2024, 10:17

Re: Sizes for mobile views in mobile Unity simulator.

12 Aug 2024, 15:08

Hi, thanks for your answer,

when you say tied to a fixed aspect ratio you mean having a fixed width and height for the main container right?

I'll check my fixed sizes then, thanks!
 
User avatar
sfernandez
Site Admin
Posts: 3112
Joined: 22 Dec 2011, 19:20

Re: Sizes for mobile views in mobile Unity simulator.

13 Aug 2024, 11:58

when you say tied to a fixed aspect ratio you mean having a fixed width and height for the main container right?
Exactly, if you have your root container set to a fixed width/height (for example 1920x1080), even if you wrap it with a Viewbox it won't be able to scale properly to other aspect ratios without stretching or leaving margins.
 
AliciaCastillo
Topic Author
Posts: 16
Joined: 16 Apr 2024, 10:17

Re: Sizes for mobile views in mobile Unity simulator.

13 Aug 2024, 14:28

Okay, I see it clearer now, thanks!

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest