Forum rules - please read before posting.

Integrating Text Animator

I absolutely adore Adventure Creator. It's been a total game-changer. I just have one question:

Are there any updates on integrating Text Animator (https://assetstore.unity.com/packages/tools/gui/text-animator-for-unity-158707)? I've checked and followed these forum posts:

I have checked and followed these forum posts:

https://adventurecreator.org/forum/discussion/8236/adventure-creator-dialogue-system
https://www.adventurecreator.org/forum/discussion/9607/possible-to-integrate-text-animator-asset-with-ac
https://adventurecreator.org/forum/discussion/10633/adventure-creator-dialogue-with-text-animator

I attempted to implement the suggestions from the authors, but they didn't seem to work. Since I'm new to coding, I might have done something wrong. While I do have the Dialogue System and PlayMaker, integrating these plugins just to make Text Animator work feels like an excessive amount of unnecessary effort, especially for someone like me who's still learning the ropes.

It would be fantastic if someone could share some tips or guidance on this issue. Thanks in advance.

Comments

  • Welcome to the community, @ywywww.

    It really comes down to how you'd like the two to integrate. Would you be looking to just have Text Animator be used for AC speech?

  • Thanks for your quick response! Yes, I think it would be great if I could somehow integrate Text Animator's effects into the Play Speech Action by using Text Animator's tag.

    My goal is to add unique effects to specific words during dialogues whether it's between NPCs or the player.

    I came across these two forum posts:
    1 https://www.adventurecreator.org/forum/discussion/9691/ac-and-text-animator
    2 https://adventurecreator.org/forum/discussion/9607/possible-to-integrate-text-animator-asset-with-ac#latest

    And I attempted to implement the code you suggested.

    However, I'm a bit stuck. I'm unsure how and where to get the TextMeshProUGUI instance that needs to be linked to the public field of TextMeshProUGUI in the code snippet below:

    public TextAnimatorPlayer textAnimationPlayer;
    public TextMeshProUGUI textMeshProUGUI;
    
    private void Update()
    {
                textAnimationPlayer.ShowText(textMeshProUGUI.text);
    }
    
  • There shouldn't be a need for the use of TextMesh Pro any more - events can be used to update the Text Animator component when speech plays.

    Something like this may be enough:

    using UnityEngine;
    using AC;
    
    public class TextAnimatorSpeech : MonoBehaviour
    {
    
        public Febucci.UI.TextAnimator textAnimator;
    
        private void OnEnable () { EventManager.OnStartSpeech_Alt += StartSpeech; }
        private void OnDisable () { EventManager.OnStartSpeech_Alt -= StartSpeech; }
    
        private void StartSpeech (Speech speech)
        {
            textAnimator.SetText (speech.FullText, false);
        }
    
    }
    

    You'll need to use Unity UI as the basis for your Subtitles menu, and have this script attached to the UI prefab with the Text Animator assigned in its Inspector.

  • It works! Thank you so much for your help!

  • Hello! Is there a way to adjust this code to use the new 2.0 Text Animator API?

  • I adjusted it so it, replacing
    Febucci.UI.TextAnimator with Febucci.UI.TextAnimator_TMP
    and that helped, but the text seems to constantly pause, or only update when the subtitles menu is fading to the next line. Any ideas? the AC status box says the game isnt paused so I dont know what the deal is

  • edited September 2023

    The script above updates the text box at the moment the speech begins. If you rely on scrolling, you'll need to update the text each frame. Something like:

    using UnityEngine;
    using AC;
    
    public class TextAnimatorSpeech : MonoBehaviour
    {
    
        public Febucci.UI.TextAnimator_TMP textAnimator;
        private Speech activeSpeech;
    
        private void OnEnable () { EventManager.OnStartSpeech_Alt += StartSpeech; }
        private void OnDisable () { EventManager.OnStartSpeech_Alt -= StartSpeech; }
    
        private void StartSpeech (Speech speech)
        {
            activeSpeech = speech;
        }
    
        private void Update ()
        {
            if (activeSpeech == null || !activeSpeech.isAlive) return;
            textAnimator.SetText (activeSpeech.displayText, false);
        }
    
    }
    
  • Ahh, thank you so much!

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.