Forum rules - please read before posting.

Speech text scroll audio doesn't end immediately when the text is done scrolling

Unity 6.0.25f1
AC 1.83.0

I have a 1 second scroll sound clip that plays with scrolling speech lines. But when the speech line is long enough to take, say, 1.5 seconds, then the second time the clip plays as it loops (as desired) doesn't immediately stop when the speech sound has ended, but instead continues until the whole clip has finished playing. Or say, if the speech line takes 0.5 seconds to scroll and appear fully, then the 1 second clip plays out completely rather than immediately stopping at 0.5 seconds as well. From what I can see, the complete sound also plays if I click to skip the text with a mouse click to display full text immediately.

Is there any way to stop the scrolling sound at the same time as when the speech line has finished scrolling and has been fully displayed?

Settings -
image

Comments

  • edited May 4

    Are you referring to the speech ending (i.e. the menu disappearing), or it stopping scrollgin?

    If you have a Default Sound object in the scene, that's where the sounds will play from - and you can use a custom event to stop it:

    private void OnEnable () => EventManager.OnStopSpeech += OnStopSpeech;
    private void OnDisable () => EventManager.OnStopSpeech -= OnStopSpeech;
    
    private void OnStopSpeech (Char speakingCharacter)
    {
        KickStarter.sceneSettings.defaultSound.audioSource.Stop ();
    }
    

    If you're referring to the scrolling, use the OnEndSpeechScroll event instead.

  • Works, thanks! I meant for when it stops scrolling. Here's the updated code for anyone looking for the solution -

    using UnityEngine;
    using AC;
    
    public class SpeechStopper : MonoBehaviour
    {
        private void OnEnable() => EventManager.OnEndSpeechScroll_Alt += OnEndSpeechScroll;
        private void OnDisable() => EventManager.OnEndSpeechScroll_Alt -= OnEndSpeechScroll;
    
        private void OnEndSpeechScroll(Speech speech)
        {
            KickStarter.sceneSettings.defaultSound.audioSource.Stop();
        }
    }
    
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.