Aspect Ratios

Announcements, support questions, and discussion for the Dialogue System.
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Aspect Ratios

Post by Escara »

Hi Tony.

I hope you're well.

I'm having some issues when running my game after the build. The target platforms are Windows and Mac and I've chosen to only build to 16:10 ratio. I think that's ok? The game itself runs fine however the Dialogue Manager's modified Standard UI I'm using seems to position the dialogue boxes in odd positions on the screen. Is there a way to force the UI to stay the same as it appears when I run the game from Unity itself? To note, I'm using a Macbook to build the game in Unity.

A couple of screenshots to highlight my issue.

How it appears in Unity.


How it appears in the running game.


Is there a way to disable this? I've tried amending the project setting but it doesn't seem to affect it. The UI appears differently for each setting.



It appears even stranger playing on a Windows laptop.

Any help, as always is very much appreciated.

Caroline
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

Just been reading up on PlayerPrefs. Do I need to delete some files in order for any changes to work? This is all a bit confusing.
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

Also, would a lettingboxing asset help? Something like Camera Fit: Screen Handler? Really I'd like to be as inclusive as possible for all aspect ratios.
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

And a bit more information that might help. I'm using Adventure Creator's Force Aspect Ratio within the Settings under camera. It's set to 1.77 which I believe is 16:9. When I turn that off the Dialogue appears in the same place so I'm now wondering if this is something AC related. I'm reluctant to switch is off as the Menus appear squished and squashed but if that's the only way I'll do some digging to see if I can adjust the Menu.... Just figured out I can untick the 'Always fit on Screen' on the Menu in question, which seems to look ok in Unity, not tried it yet in a built game.

So I may have solved the issue myself but I'll need to do some testing. Are there any alternative suggestions that I can apply to the Dialogue UI?

Thanks again,

Caroline
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Aspect Ratios

Post by Tony Li »

Hi,

The Dialogue System's Adventure Creator integration has a Fit UI To Aspect Ratio script. Try adding it to the Dialogue Manager's Canvas. This should get the dialogue UI to play nicely with Adventure Creator's Force Aspect Ratio setting. (And, if not, we can look into it further to get it working just right.)
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

Thanks Tony.

I did have a play around with that but I couldn't get it to work. What should I be using for the 'Main Panel' within that component?

I found this from two years ago as it appears someone had the same issue as me https://adventurecreator.org/forum/disc ... i-canvases

Many thanks

Caroline
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Aspect Ratios

Post by Tony Li »

Hi Caroline,
Escara wrote: Fri Jun 28, 2019 8:51 amI found this from two years ago as it appears someone had the same issue as me https://adventurecreator.org/forum/disc ... i-canvases
Yup, that's where the "Fit UI To Aspect Ratio" script had its genesis.

But I just remembered that Unity now has its own Aspect Ratio Fitter component. Might as well use the built-in features. Here are the steps:

1. Create a panel (RectTransform) that covers the whole screen.
2. Add your UI elements as children of this panel.
3. Add an Aspect Ratio Fitter component.
4. Set the Aspect Mode to Fit In Parent.
5. Set the Aspect Ratio to the same value as AC's Settings > Camera Settings > Aspect Ratio.

aspectRatioFitter.png
aspectRatioFitter.png (38.83 KiB) Viewed 2017 times
I'll update the instructions in the Dialogue System manual's AC section to use the steps above.
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

Amazing!

Thank you Tony! I've been scratching my head about this for ages. Should've come to you sooner! I'm now a very chuffed and happy lady!

Just got a few things to sort out then my demo will be ready for external testing and then a release later in the year!

So happy right now!

Caroline :)
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Aspect Ratios

Post by Tony Li »

Glad to help!

That's great to hear about your demo, too!
Escara
Posts: 78
Joined: Sun Dec 30, 2018 4:55 am

Re: Aspect Ratios

Post by Escara »

Actually I spoke too soon.

What do you mean exactly by
1. Create a panel (RectTransform) that covers the whole screen?

The UI space as that changes depending on what aspect ratio I choose.

Sorry to be a pain!
Post Reply