If you want to change the typewriter effect to use FMOD, make a subclass of your typewriter script (UnityUITypewriterEffect or TextMeshProTypewriterEffect) and override PlayCharacterAudio(). Something like:
Code: Select all
public class MyTypewriterEffect : TextMeshProTypewriterEffect
{
protected override void PlayCharacterAudio()
{
FMODUnity.RuntimeManager.PlayOneShot("your typewriting sound");
}
}
If you want to play different sounds based on the character being typed, you can override PlayCharacterAudio(char c) instead (or in addition).
different sound based on the actor, you could set "your typewriting sound" in an OnConversationLine method, or by overriding StandardUISubtitlePanel.ShowSubtitle, or right in your overridden typewriter script: (In this example, the actor has a custom field named "Typewriter Sound" that names the FMOD event.)
Code: Select all
public class MyTypewriterEffect : TextMeshProTypewriterEffect
{
private string soundEvent;
public override void StartTyping(string text, int fromIndex = 0)
{
Actor actor = DialogueManager.masterDatabase.GetActor(DialogueManager.currentConversationState.speakerInfo.id);
soundEvent = actor.LookupValue("Typewriter Sound");
base.StartTyping(text, fromIndex);
}
protected override void PlayCharacterAudio()
{
FMODUnity.RuntimeManager.PlayOneShot(soundEvent);
}
}