Forum rules - please read before posting.

FEATURE REQUEST: Addition to Auto-scroll Type Effect

When using the auto-scroll feature for subtitles and the text-scroll audio is playing (in this case the sound of a typing keyboard) would it be possible to have an option to automatically stop the currently-playing audio as soon as the text either hits a [wait] call or whenever the last character has been displayed?

Right now I have an audio clip of a typing keyboard that lasts around 10 seconds for variation, otherwise it sounds like an obvious looping audio clip, so as it stands now it will continue playing the audio for anything up to 10 seconds after the last character has been displayed.

Unless of course there's an option for this that I've overlooked?

Comments

  • You can hook into the OnEndSpeechScroll custom event, triggered when scrolling ends, to stop the audio:

    using UnityEngine;
    using AC;
    
    public class StopScrollAudio : 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 ();
        }
    
    }
    

    If you cut a sound mid-way through, though, it might sound jarring. It may be better to instead break up your typewriter audio into "individual key press" clips, and use a different script to assign them randomly in the Speech Manager at runtime:

    using UnityEngine;
    using AC;
    
    public class RandomScrollAudio : MonoBehaviour
    {
    
        public AudioClip[] scrollAudioClips = new AudioClip[0];
    
        private void Update ()
        {
            int index = Random.Range (0, scrollAudioClips.Length);
            AudioClip audioClip = scrollAudioClips[index];
    
            KickStarter.speechManager.narrationTextScrollCLip = audioClip;
            KickStarter.speechManager.textScrollCLip = audioClip;
        }
    
    }
    
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.