Forum rules - please read before posting.

SubtitlesUI option re resizing Panel vertically AND horizontally

Hi Chris, I've got 'Super Text Mesh' working using the ACWiki script.
However, the issue I'm encountering with using UnityUI Prefab for the Subtitles menu over AC's own option is this:
I can't seem to find a way to shrink the panel horizontally for short words and phrases. It's great that the panel expands vertically the more text there is, but I can't seem to find a way with UnityUI / Canvas to have the panel shrink to a minimum horizontal size for eg 1 word responses, so I get these long unfilled panel backgrounds:

It's fine when the horizontal space is filled up with text, but looks wrong when there's little text:

What I liked about the AC option is the background panel would adapt to however much text there was, eg some short options, there's no unnecessary horizontal empty space:


Do you know of a way to have the panel adapt ie shrink to the child text object, please? Almost like setting a 'this is the minimum size it should shrink to horizontally, and this is the maximum size'. I've watched a couple tutorials and been experimenting all afternoon without luck. The most I seem to be able to do with Unity's Canvas is set a maximum horizonal size for the panel, after which the text will wrap and the panel will expand downwards vertically, but no way afaik to have it shrink down horizontally. And I believe I need to use a UnityUI Prefab to get Super Text Mesh to work, as it uses Text Mesh Pro and I need to add the ACWiki script to the TMP object.

Comments

  • I think it's probably solvable with this video I saw someone else post on these forums:

    Struggling but hoping to crack it sooner or later.

  • edited September 25

    Alright, think I got it working. Might not mean much to anyone else here, but if anything, leaving it so my future self can come back to it if needs be (have Googled stuff in the past and found my own threads here explaining stuff I'd forgotten, lol!)

    To get Super Text Mesh working well for AC Subtitles:

    • If you own it, download Super Text Mesh into the project, and get the AC script integration on the AC Wiki.
    • Create a new AC game in Unity and choose the option to use Text Mesh Pro menus.
    • Load up the 'Subtitles' Menu and see the SubtitlesUI Prefab it's connected to. Open it up.
    • For the subtitles line, the AC menu 'Linked Text' will only accept a game object that has a 'Text Mesh Pro' component added to it (even the component is disabled), so either add a SuperTextMesh component to the existing Text element and disable Text Mesh Pro on it, or create a new blank game object that's a child of the Panel parent, and add Text Mesh Pro to it, disable it, and add Super Text Mesh. Then you can link it to the 'Linked Text'.
    • Test it out - Super Text Mesh should be showing up as the text in the subtitles. But it's only showing the sample text and not the character dialogue? That's because we still need to add the 'SuperTextFromACSpeech.cs' script that we got from the ACWiki, onto the game object that displays the text. Now, it should be feeding in text from whatever the character is saying.

    That's the basics of it. With Super Text Mesh, can now use tags like <w>Cool Beans</w> to get wavy text, <j>SPOOKY</j> to get jittery text and so on.

    The next part (not specific to Super Text Mesh) is getting the subtitles dialogue background box to kind of clamp around the text so that we don't get big empty horizontal dialogue boxes when there's only a small amount of text. It's too much to explain here, but I had to rewatch this vid a couple times and try and apply it to the existing SubtitlesUI Prefab. There's some stuff that's different since the tutorial was recorded 8 years ago. This is basically the setup that I ended up with that seemed to result in an adaptive background that had a minimum horizontal size and a maximum horizontal size.

    Canvas UI Setup:
    https://ibb.co/KcSvqJVp
    https://ibb.co/NnWDhFkd
    https://ibb.co/Jw8tpkqD
    https://ibb.co/V085XBzm
    https://ibb.co/s9GJZZn8
    https://ibb.co/9kg3KzyF
    https://ibb.co/HpfJFgCF
    https://ibb.co/fzyzNv52

    AC Subtitles Menu Settings and wire-up (importantly, 'Duplicate for each line' should be turned off to avoid some visual weirdness like dialogue lines appearing briefly above the wrong player's heads):
    https://ibb.co/Sw8Dq4mS
    https://ibb.co/nMWRNChx

    Resulting Subtitle look:
    https://ibb.co/RGVTW9jG
    https://ibb.co/WN93cKLM
    https://ibb.co/ymNj88RK
    https://ibb.co/3yScB2yM

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.