Hello Chris, I'm noticing a weird behavior with aspect-ratio. (I've set it in the settings to be fixed 1.7777).
All works good if I change it in-game (via Pause menu) or from Main Menu.
So the forced aspect-ratio is actually working. But, it doesn't apply when I change resolution via saved options...
Let me explain better:
My question is: can I refresh AC aspect ratio via script? So I can do that each time I call my SetOptions script (after loading a saved game)?
Thanks
P.S. I thought the aspect ratio was automatically applied each time the "Screen.SetResolution" is called, but my SetOptions do that, and yet it's not applied. So I wonder if there's a way to refresh that manually.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
UPDATE:
Apparently the problem is not with the Game Camera, which is correctly working also after loading, but with the various AC Menu UI (they are all Unity Prefabs).
So the AC Menu UIs change properly the aspect ratio if I do from Main Menu Options or Pause Menu Options, but they have the issue above when changing from Main Menu Options and then Loading a saved option.
Each of them has the Auto-correct UI Dimensions properly set. So maybe that's the script that needs to be refreshed? Or, in general, all the AC Menus?
Or somehow trigger manually the Event "OnUpdatePlayableScreenArea"?
I guess this last option might be the one that makes it work, but I'm not sure how to do it... any clues?
Sorry for the confusion...
You can trigger the event manually with:
Thanks, and what about the first part of my thread... I mean, calling a refresh of the aspect ratio of the Game Camera? Is there a way to call that too just to be sure? Or that is also refreshed with the event OnUpdatePlayableScreenArea?
UPDATE: Apparently the OnUpdatePlayableScreenArea works only with the UI, but doesn't "refresh" the aspect ratio, so there's indeed a case in which my Game Camera set to 4:3 on Main Menu is kept even on a Loaded Game that retains options for a 16:9 resolution (which sets the UI correctly to 16:9, but doesn't affect the Game Camera). Maybe this has something to do with something in the persistent Persistent Engine? So at the moment I change my resolution in Main Menu (and the aspect ratio is adjusted), it keeps that value even after Loading a scene which set the saved options to a different ratio?
As this is a visual issue, I'm not totally clear on the problem you're describing without screenshots. However, the MainCamera's RecalculateRects function will update camera aspect ratio data:
Thank you Chris.
After many attempts I've found out the issue was with another script I had that was adjusting the ratio... I removed it and AC alone is now handling it perfectly.