Forum rules - please read before posting.

SpeechBubbleUI and Text Animator integration problem

Hi,
For my dialogues I am using SpeechBubbleUI and Text Mesh Pro instead of Adventure Creator’s interface.
I am also using Text Animator to add effects to the text.

But when I add an effect tag to the text, the scroll stops working, the text box appears empty, and the text pops up all at once after a while.
I think the time it takes is the same as it would take to display the text with the scroll.
Once it appears, the Text Animator effects and the Adventure Creator tags work fine.
With only AC <b and <i tags the scroll works perfect.
Video here:
https://drive.google.com/file/d/1TyP3wLNb6FM3DSYNB0C-2U2GdBNdqGKJ/view?usp=sharing

To set this up, I followed the instructions from this post:
https://adventurecreator.org/forum/discussion/15687/text-animator-integration#latest

This is the script I am using:

    using UnityEngine;
    using AC;
    using TMPro;
    using Febucci.UI;

    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;
            textAnimator.GetComponent<TMPro.TextMeshProUGUI>().maxVisibleCharacters = 0;
            textAnimator.SetText(activeSpeech.FullText, false);
        }

        private void Update()
        {
            if (activeSpeech == null || !activeSpeech.isAlive) return;
            textAnimator.GetComponent<TMPro.TextMeshProUGUI>().maxVisibleCharacters = activeSpeech.CurrentCharIndex;
        }
    }

These are my settings:
https://drive.google.com/file/d/1d5Taej2Mwqfna95dgKG3yB4lBB1_ubrx/view?usp=sharing

Comments

  • edited May 16

    With only AC <b and <i tags the scroll works perfect.

    Is this to say such tags work with the same setup, i.e. the Text Animator component?

    Can you share the raw text being used to display the speech in your example?

  • This is the text im testing with:
    <shake>Someone's</> there!? <shake>Hey</>, boy! <b>TEST</b>TEST <i>TEST</i> TEST TEST TEST TEST

    In this one, without text animator tags, everything works as it should.
    There's someone there! Hey, kid! <b>TEST</b>TEST <i>TEST</i> TEST TEST TEST TEST TEST TEST TEST TEST.

  • edited May 19

    I don't know if </> is a shorthand in Text Animator, but try it with regular closing tags, i.e.:

    <shake>Someone's</shake> there!? <shake>Hey</shake>, boy!   <b>TEST</b>TEST <i>TEST</i> TEST TEST TEST TEST
    

    Remove the "/" entry from the Dialog component, too.

  • With </shake> instead of </> and deleting "/" entry, the text is not displayed at any time.

  • Recreated, thanks.

    With three assets in the mix, it's not clear yet where the issue lies - but I will look into this.

  • Ok thanks!

  • Right, try this instead.

    Update the Inspector with a reference to the Canvas, and - the Menu - check "Duplicate for each line" and remove the Label element that shows the subtitles.

    Also remove the custom tags from the GameEngine's Dialog component.

    using UnityEngine;
    using AC;
    using Febucci.UI;
    
    public class TextAnimatorSpeech : MonoBehaviour
    {
        public TextAnimator_TMP textAnimator;
        public Canvas canvas;
        private Speech activeSpeech;
    
        private void OnEnable() { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
        private void OnDisable() { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
        private void OnMenuTurnOn(Menu menu, bool isInstant)
        {
            if (canvas && menu.RuntimeCanvas == canvas)
            {
                activeSpeech = menu.speech;
                textAnimator.GetComponent<TMPro.TextMeshProUGUI>().maxVisibleCharacters = 0;
                textAnimator.SetText(activeSpeech.OriginalText, false);
            }
        }
    
        private void Update()
        {
            if (activeSpeech == null || !activeSpeech.isAlive) return;
            textAnimator.GetComponent<TMPro.TextMeshProUGUI>().maxVisibleCharacters = activeSpeech.CurrentCharIndex;
        }
    
    }
    
  • Thanks Chris, it worked!

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.