Hey guys, I’m trying to convert one of the games I’m working on to work with fmod. As it stands, all of the sounds and music are currently being played using Unity’s audio engine, and I’m having trouble figuring out how the playoneshot works. is there any good documentation or tutorial I could use to get myself and my team familiarized with fmod with unity?"
like for example, i have a 2D sound i want to play which is assigned to the master bank. I want it to play whenever it is called in script, but I want to play in accordance with the game’s speed (if the game slows down, it slows down as well / if the game is paused, the sound is paused as well).
Currently the script is this:
using UnityEngine;
using System.Collections;
public class Lightning : MonoBehaviour {
public AudioClip[] thunderSounds = new AudioClip[4];
private bool flashing = true;
// Use this for initialization
void Start()
{
StartCoroutine(Flash());
}
// Update is called once per frame
void Update()
{
if (!GamePlay.paused)
{
GetComponent<AudioSource>().pitch = Time.timeScale;
if (flashing)
{
if (GetComponent<Light>().range > 0)
GetComponent<Light>().range -= Time.timeScale;
}
else
{
GetComponent<Light>().range = 80;
GetComponent<Light>().enabled = true;
flashing = true;
GetComponent<AudioSource>().PlayOneShot(thunderSounds[Random.Range(0, thunderSounds.Length)], Global.GameSound);
}
}
}
IEnumerator Flash()
{
while (true)
{
yield return new WaitForSeconds(Random.Range(0f, 20f));
flashing = false;
}
}
}
what would I do to make it so that the script plays the fmod sound effect instead of the sound effect it already has?