Forum rules - please read before posting.

Adventure Creator Dialogue with Text Animator

Hi everyone

I'm working on my first project and I love the way the AC pipeline works but I've recently purchased this asset https://assetstore.unity.com/packages/tools/gui/text-animator-for-unity-158707
from the asset store and I'd like to utilize the text animations for the player lines eg for interactions like inspecting or talking with a hotspot.

I had tried to integrate TextMeshPro with AC following this guide on the wiki
https://adventure-creator.fandom.com/wiki/Text_Mesh_Pro_integration

I thought if I could get that TextMesh working with AC then the animation shouldn't be too difficult but I have been unable to get this working the way that I wanted.

From what I've been able to find online and within previous forum posts here like this one https://www.adventurecreator.org/forum/discussion/9691/ac-and-text-animator

it seems like there are some issues with getting AC and TextAnimator to work well together. I also have the asset "Dialogue System for Unity" and wondered if I should look at integrating that with AC to handle the dialogue within the game and attempt to apply the textmeshpro effects to the text within that system instead but am not sure if I am needlessly complicating everything at this point.

Does that seem like the best way to go about things, to use AC to set up the scenes, characters, hotspots etc but use the dialogue system to handle the actual text or is there a way to get AC to still handle all the dialogue and animate the text without bringing a whole other system into it.

Any advice is greatly appreciated

Comments

  • Welcome to the community, @artilectzer0.

    The wiki page you've linked to is outdated - AC's TextMeshPro integration is now built in.

    See the Manual's "Supported third-party assets" chapter for details, but you can enable the integration by adding "TextMeshProIsPresent" as a Scripting Define Symbol.

    By itself, AC doesn't have text animation features - though with custom events it shouldn't be too difficult to incorporate. By hooking into the OnStartSpeech custom event (see this tutorial), you can retrieve a character's speech text at the moment they begin talking - which you can then make use of in a custom UI.

    As for Dialogue System, many users do make use of it with AC - though the integration is handled on the Dialogue System side of things. You'll need to contact Tony, the author, about how you can make use of it with animated text.

  • Hi Chris

    Thank you for such a swift and detailed response.

    I just have a couple more questions

    After adding the correct Scripting Define Symbol to the correct box within the player section does this cause AC to use TextMeshPro as its default text output for all text from then on or is it something that you need to assign each time?, also is there a place to check this to confirm it's working properly? I think I read somewhere that the text output is handled in the Menu manager under the Subtitles element, is there anything there that I could check?

    I have read through the link you sent and followed the tutorial, it's extremely useful to know that the text can be hooked into and then sent elsewhere. I created a default game manager object and attached the SpeechListener script and was able to get the hotspot dialogue to send through to the console.

    In regards to getting this output to work with the plugin, the effects are added by attaching some scripts (provided by the plugin) into a TextMeshPro object and then adding certain symbols/words before the word you want to add an effect. To get this working with the AC output (sorry I'm still quite new so I might be a bit off) would this be done by creating a new canvas ui and textmeshpro element, positioning in the correct place (eg above character head), editing the SpeechListener script to send output to the TextMeshPro object instead of the Debug.Log and then have visiblity toggle on mouse clicks or something?

    Also with how the SpeechListener works would it only be sending it to the same TextMeshPro object each time? Just thinking about characters talking on different parts of the screen or different name/word colours etc.

    Thanks again for the help

  • For TextMeshPro to have an effect on your UI, you need to have your Menus rely on Unity UI. This is a case of setting a Menu's Source property to Unity Ui Prefab.

    You'd then need to supply a Unity UI prefab and link each Menu Element to an appropriate component (i.e. AC Button to Unity UI Button). A tutorial on this process can be found here, and the default menus all have Unity UI variants set up already.

    To update an existing Unity UI-based Menu to rely on TextMesh Pro, you'd then need to open up the prefab and replace each Unity Text component with a TextMesh Pro UGUI component.

    If you're new to using Unity UI with AC, I'd recommend removing the Scripting Define Symbol and having a look through the default UI prefabs - to see how things behave normally.

    On the topic of using custom scripting - the SpeechListener script is just an example. If need be, you can also do things like attach a script to your Subtitles UI prefab, and have it hook into the OnMenuTurnOn event - so that you can update it as appropriate whenever speech is displayed. Since the script gets attached to the prefab, you can assign variables to update whatever component you like, for example:

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    
    public class CustomSubtitles : MonoBehaviour
    {
    
        public Text textBox;
    
        private void OnEnable () { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
        private void OnDisable () { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
        private void OnMenuTurnOn (Menu menu, bool isInstant)
        {
            if (menu.title == "Subtitles")
            {
                Speech speech = menu.speech;
                textBox.text = speech.FullText;
            }
        }
    
    }
    
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.