Forum rules - please read before posting.

Getting InventoryBox elements to left justify

Hello there,

I'm trying to get the items in my inventory to left justify to line up better with the notebook the inventory is displayed on. I'm having trouble finding a way to do this; my guess is the answer is somewhere in the MenuInventoryBox script but I can't seem to find where the text justification is set. I am using Unity version 2017.3.0f3 if that helps. Attached is a screenshot displaying my inventory:
image

Comments

  • Welcome to the community, @sheffrey.

    This'll depend what method you're displaying the Menu with essentially the Source option within the Menu's list of properties in the Menu Manager.

    The recommended setting is Unity Ui Prefab, which causes it to rely on a Unity UI canvas for display, giving you much more stylistic control.  Left-justifying the text is then just a case of amending the Text component for each associated Button.

    The default setting, Adventure Creator, is intended more for prototyping now that Unity UI has matured.  The "Text alignment" setting available for Button and Label elements is not currently available for InventoryBox elements - however I shall consider its inclusion as part of the next release.  In the meantime, you can indeed modify MenuInventoryBox.cs to enforce it.

    Within the Display override method (around line 525), insert the following to force a left-justified alignment:

    _style.alignment = TextAnchor.MiddleLeft;

  • I'd have to agree with Chris. Now the unity UI has matured, you should consider building all UI based menus etc with unity UI. It's very easy to get to grips with and very powerful.
  • The reported issue is still valid, however - look out for a fix in the upcoming v1.65.0 release.
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.