Forum rules - please read before posting.

Centring the dialogue lists in a conversation.

I am wondering if anyone has found a way of vertically centring dialogue choices within a border. I want my conversation option to be in the same location as part of my UI with a larger border. By default once the number of options are set it aligns all of the options to the top and only really sits right if all of the options are filled. My solution thus far is to have different conversation menus for different number of choices that get turned on or off depending on how many conversation options there are at the beginning and end of a conversation. This works just fine though it does start to get messy when conversations have hidden options that only pop up once they have been unlocked. As I have to start juggling options on and off.
If there was a way of making the option be displayed in the centre then it would scale itself automatically but so far I haven't been able to find one. Is there something hidden away or will I have to keep using the method I came up with?

Comments

  • Are you currently using AC or Unity UI for your Menu's Source? You'll need to switch to Unity UI if not already, as this will give you the necessary control over its styling and alignment.

    With Unity UI, AC won't reposition your elements - where they appear is down to the alignment settings of your RectTransforms and the use of Unity UI components. I'd recommend playing with a non-AC-linked UI hierarchy first to get the layout behaviour you're looking for.

    It should be possible to achieve this by parenting your option Buttons to a shared parent object, which is aligned to the centre, and then attaching the Vertical Layout Group and Content Size Fitter components to it - and then setting its Vertical Fit field to Preferred Size.

  • I completely forgot I could just use Unity UI. Got so used to just doing it in AC. I shall tinker with that in a moment then. Glad to see I wasn't going mad though if it can't be done in AC.
    Thank you Chris.
  • Alright, got the UI made and attached and it is working the way I want it with one huge caveat. It isn't putting the text from the choices into the box. The choices are working correctly when you click on them, and it scales and reorganises the number of boxes as needed, but they are all blank. I assumed I would drag the buttons from the prefab over the options in the menu which seems to work abut as soon as I leave the prefab viewer these change back to missing. I'm sure I'm just missing something simple but for the life of me I'm not seeing it.

  • Nope. Can't get the Unity to UI to show anything other than the placeholder text. What am I missing?

  • edited August 2022

    bashes head against the desk Never mind. AC just hates TextMeshPro. Changing my UI buttons to use standard text fixed the issue. Now to just work out how to change text colour once something has been selected before.

  • AC will work with TextMeshPro - but you need to let it know that it's safe to run its TMPro-referencing code, as it'll cause compilation errors otherwise.

    This is a case of going to the Player settings of your Project Settings window, and adding "TextMeshProIsPresent" as a Scripting Define Symbol. This'll cause AC to rely on TMPro equivalents for all Unity UI components.

    For details, see the Manual's "Supported third-party assets" chapter.

  • edited August 2022

    That worked wonderfully, thank you Chris. Granted now I have the urge to redo my whole UI with Unity UI but that is a me problem.
    One last quick question though, Using TextMeshPro is there any way to change the colour of the text once something has been selected like the AC version?

  • Granted now I have the urge to redo my whole UI with Unity UI but that is a me problem.

    I'm afraid this is a limitation of the feature. If you wanted to only use TMPro for a particular element, you can instead use this script on the AC wiki to configure it per-element.

    Using TextMeshPro is there any way to change the colour of the text once something has been selected like the AC version?

    When using Unity UI, colour changes are handled by Unity's Button component - you can set its Transition field to Color Tint to have it alter the colour as it's selected.

  • Thank you for that Chris, that helped a lot.

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.