Forum rules - please read before posting.

Help with UnityUI for Subtitles Menu. Center Allignement.

Hi. This is probably a bit silly. But I wonder if somebody managed to replicate this Adventure Creator Subtitles menu behaviour in Unity UI and can help me out.

https://drive.google.com/file/d/1iYmZZGuujM01sJHmkBYI7YE4tRA2pDAh/view?usp=drive_link

This is the behaviour I want to replicate. Text perfectly centered on top of the character. If the text is short, like in this case, I would like it to be in centre.

At the moment this is what I can get.

https://drive.google.com/file/d/14drHXq7Hf4xEqO9N1zzX76uujljGfYgz/view?usp=drive_link

The issue is that I don't want to centre the text paragraph alignement or it will become difficult to read when a word
appears in the centre.

But in order to make it stay in the centre using a "preferred size" in the Contente Size Fitter, the text doesn't wrap anymore.

This is the Subtitles Unity Prefab at the moment:
https://drive.google.com/file/d/1Vm5jzGdX1RopuudtgYT6shC0jKKZqFvV/view?usp=drive_link
This is centered:
https://drive.google.com/file/d/18BtKAKZOcJmHmtwUN8-SNS4vnPMgLuYZ/view?usp=drive_link
But it doesn't wrap:
https://drive.google.com/file/d/1gGAvrMkY7WdVxeRsaK19aa2W8f-bJnaC/view?usp=drive_link

Anyone who managed to find the right setting to use in Unity to keep the text centered AND to wrap when it reach a specific width AND to keep it always visible inside the screen?

I tried different combination in the text and in the parent panel but with no good results.

Many thanks.

Comments

  • edited March 7

    The last post in this thread should help.

  • Sorry @ChrisIceBox the link send me back to this thread.

  • Ok, after more fiddling I found the solution. I'll write it here for reference.
    In the parent panel:
    Content Size Fitter:
    - Horizontal Fit: Unconstrained
    - Vertical fit: preferred size

    Horizontal Layout Group
    -Child Alignment: Middle Center
    -Control Child Size: Width and Height checked
    -NOTHING ELSE CHECKED

    TextMeshPro (as child as the panel)
    Wrappin: Enabled
    Overflow: Overflow

    For the record I had Child Forced Expand checked in the Horizontal Layout Group and that was the cause of my issue.

  • edited March 7

    -

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.