Skip to content

synnys/fmodyarnspinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽญ FMOD & Yarn Spinner Integration for Unity

This repository provides a fully integrated FMOD & Yarn Spinner system for interactive dialogues with dynamic audio in Unity. It supports multi-language voiceovers, FMOD event triggering, and camera-based audio listeners for a more immersive experience.

๐Ÿš€ Features

FMOD Event Mapping to Yarn Lines

Assign English (EN) and Alternative (ALT) FMOD events to Yarn dialogue lines.

Automatically extracts Line IDs from Yarn scripts.

Dialogue-Driven FMOD Sound Triggering

Play FMOD events from Yarn scripts.

Adjust FMOD parameters directly from Yarn commands.

Multi-Language Support

Toggle between English & an alternative language with a UI button.

Each Yarn line can have a separate FMOD event for each language.

FMOD Camera-Based Listeners

Integrates with Cinemachine virtual cameras.

Ensures audio perception follows active cameras.

Fully Modular Setup

Drag-and-drop Yarn scripts into the Inspector.

Automatically populates Line IDs for easy FMOD event assignment.

๐Ÿ“ฆ Installation & Setup

1๏ธโƒฃ Import the Package

Clone this repository or download the Unity package.

Import it into your Unity project.

Ensure FMOD Unity Integration and Yarn Spinner are installed.

2๏ธโƒฃ Set Up the Dialogue System

Attach Scripts to the Dialogue Runner

To centralize all functionality, attach these scripts to the Yarn Spinner Dialogue Runner:

FMODLineProvider.cs

FMODDialogueView.cs

YarnFMODTrigger.cs

FMODLanguageToggle.cs

FMODCameraListenerManager.cs (Attach to AudioManager GameObject)

3๏ธโƒฃ Configure FMOD Event Assignments

Add the FMODLineProvider component to the Dialogue Runner.

Drag your Yarn script(s) into the Inspector under Yarn Script.

Click Update Lines to extract Line IDs.

Assign FMOD Events for English & ALT languages.

Toggle between EN/ALT using the UI button.

4๏ธโƒฃ Enable FMOD Audio for Dialogue Lines

The FMODDialogueView script automatically plays FMOD events assigned to Yarn dialogue lines.

Uses the current selected language (EN or ALT).

Plays the event when the corresponding Yarn line is reached.

5๏ธโƒฃ Trigger FMOD Events & Parameters from Yarn Scripts

Use commands inside Yarn scripts:

// Play an FMOD event manually <<PlayFmodEvent "event:/EN_MALE1">>

// Adjust GLOBAL FMOD parameters <<SetGlobalParameter "tension" 1.0>>

(make sure your fmod parameters are set to global, if you're unsure, right click the parameter in FMOD, click edit parameter, and set it to global) 6๏ธโƒฃ FMOD Listener Follows Active Camera

The FMODCameraListenerManager script ensures the correct FMOD Studio Listener is enabled based on the active Cinemachine Virtual Camera.

Attach FMOD Studio Listeners to Cinemachine cameras.

Assign camera-listener pairs in the FMODCameraListenerManager.

๐ŸŽฎ Usage Guide

๐Ÿ”€ Switching Languages at Runtime

A UI button toggles between English & Alternative language voiceovers.

Assigned via FMODLanguageToggle.cs.

Dynamically updates the played FMOD event based on the selected language.

The Yarn text remains in English (subtitles) while audio changes.

๐Ÿ“œ Using Multiple Yarn Scripts (Per NPC)

For projects with multiple NPCs, use separate Yarn scripts per character.

Add multiple Yarn scripts to the FMODLineProvider.

Assign FMOD events separately for each NPCโ€™s lines.

The system automatically detects and plays the correct voiceover.

๐Ÿ›  Debugging & Logging

โœ… Check the Console Logs

Successful mapping: โœ… Mapped Yarn Line: line:xxxxxx โ†’ FMOD Event

Missing FMOD event: โš ๏ธ No FMOD event assigned for Yarn Line ID

Event playing: ๐Ÿ”Š Playing FMOD Event: event:/EN_MALE1

๐ŸŽฏ Future Improvements

๐Ÿ”น More granular control over audio mixing (reverb, spatial effects) ๐Ÿ”น Multiple alternative languages support ๐Ÿ”น Live Yarn script reloading without restarting Unity

๐Ÿ“ Credits

Developed for interactive storytelling in Unity, integrating FMOD for immersive audio. Built using Yarn Spinner to create dynamic and engaging dialogue-driven experiences.

โšก License

This project is licensed under the MIT License. Feel free to modify and expand upon it!

๐ŸŽต๐ŸŽญ Happy game developing! ๐Ÿš€

About

An audio manager for using FMOD with yarnspinner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published