Forum rules - please read before posting.

Default character sound to play when speaking?

I will not be having voice over for my game, but am looking to play a sort of Simlish gibberish that would be unique to each character. Is there a way I can set for a default sound to play whenever a specific character speaks? I would prefer to not have to make a separate item in action lists to play that sound every time they talk.

Thanks!

Comments

  • You can assign a "Text scroll audio" for each character, that gets played when speech text is scrolled.

    For a more robust approach, however, you can hook into the OnStartSpeech / OnStopSpeech custom events to playback audio based on the character. These events include the speaking character in their parameters, so you can attach a script to a character, check if a speech is being spoken by them, and play audio if so.

    For example:

    using UnityEngine;
    using System.Collections;
    using AC;
    
    public class GibberishExample : MonoBehaviour
    {
    
        public AudioClip gibberish;
    
        private void OnEnable ()
        {
            EventManager.OnStartSpeech += StartSpeech;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStartSpeech -= StartSpeech;
        }
    
        private void StartSpeech (Char speaker, string text, int lineID)
        {
            if (speaker == GetComponent <Char>())
            {
                AudioSource.PlayClipAtPoint (gibberish, transform.position);
            }
        }
    
    }
    
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.