To better understand the implementation of Fmod by script, I am trying to recreate the Survival Shooter implementation published some years ago. As I was advised some time ago I used the two software versions in which currently works (Fmod 1.08 and Unity 2018.3). Unfortunately, after many attempts and searches in the forums, I don’t know how listen music contained in my Fmod file as musicEv.start () does not seem to work (see below). Indeed I correctly heard the sound effects created with Fmod;
I clarify that:
- in edit settings I correctly linked the .fspro file to the Fmod integration
- in the Fmod event browser I correctly listen to all the audio contained in the .fspro
- I have no error in the console
- I also tried to update the two software to the latest versions and, while the game works perfectly (!), the audio through script doesn’t go even also in this case. Can anyone help me please?
Thank you
This is the MusicControl.cs concerned:
using UnityEngine;
using System;
using System.Collections;
public class MusicControl: MonoBehaviour
{
[FMODUnity.EventRef]
public string music = "event: / Music / Survival_Shooter";
public FMOD.Studio.EventInstance musicEv;
void Start ()
{
musicEv = FMODUnity.RuntimeManager.CreateInstance (music);
musicEv.start ();
}