Forum rules - please read before posting.

Bugs (plus fixes) around varying aspect ratios

Hey Chris! :)
I was noticing some weirdness with my menus on machines of varying aspect ratios (despite having set Force aspect ratio), and I found a solution (some of it is hackier than others :P ).

In Menu.cs, I found a few (I think) typos: in PositionElements and AutoResize, x and y are mixed up a few times. E.g.:
rect.height = (spacing / 100 * AdvGame.GetMainGameViewSize ().x) + biggestElementSize.y;
instead of:
rect.height = (spacing / 100 * AdvGame.GetMainGameViewSize ().y) + biggestElementSize.y;

Also, there are loads of calls to AdvGame.GetMainGameViewSize (), but the resulting value doesn't take into account the borders if you're forcing aspect ratio, meaning that menus will be drawn without consideration for the letterboxing, ending up with menus "offscreen". I resolved this by making a second method GetMainGameViewSizeRespectingBorders and calling that at all the places that didn't need an absolute coordinate. I can see this being solved in various ways, but I just wanted to flag that the problem exists (and that there exist easy solutions).

Thanks Chris! As always, so pleased with AC! (and after these tweaks, my game is working perfectly on a variety of machines/OSs/aspect ratios!) :D

Comments

  • Thank you.  It's been a while since those functions were written, so I don't want to discount my having had a reason for it being like that.  I appreciate you going to the effort of posting potential code changes, but I would need instead to know of the original issue you're facing.  If you can, please post screenshots and full details of exactly what was going wrong, and I'll be in a much better position to do something about it.

    As for the Menus not being within the boundary, there are already checks for that.  What is your Menu's position type, and have you checked "Always fit within screen?"?  A screenshot of your Menu's list of properties in the Menu Manager will help understand what's going on.
  • Oh, duh, sorry for not doing so before: https://imgur.com/a/bFb41

    You can see an in-game menu that looks differently between 16:9 and 16:10, which is partially fixed by the x/y changes, and completely fixed by the broader changes.

    You can also see the main menu looking differently between the two, which is fixed by the broader changes. (essentially the specified 81.4% of the way down the screen is including the black bars, making it overflow. Conceptually, I suspect we just want to make those calculation factor out the black bars)

    "Always fit within screen" isn't available with centered menus.
  • In the case of the main menu, you could align it to the bottom of the screen, and you'd then have the option - unless I'm missing a reason it needs to be centered.

    My fear is that there's too much that can go wrong if changes are made.  Existing AC-driven Menus will almost certainly have to be tweaked for all games that makes use of them, and with the vast number of options within the AC Menu system some of these will be larger than others.

    I should also note that, given the maturity of Unity's new UI system (which wasn't around when AC's Menu system was build), the AC-driven menu system is really more suited to prototyping at this point, and I would recommend that Menus switch over to Unity UI prefabs for their display once functionality is decided.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.