Survival Shooter

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 ();
}

I’d try looking in the FMOD profiler. Although music is generally a 2D event, it may be the case that it’s playing but the camera is not close enough. Checking the profiler should show if the event is playing or not.

If it’s playing, make the music a 2D event or move the listener (the tutorial goes over creating a child object to make the listener at ground level).

If it’s not playing, I’d try lots of debugging. Check the results of each FMOD operation for errors (using FMOD.RESULT variables returned by FMOD functions).

But tbh, I don’t know. ‘Why does my sound not play’ is an age-old problem in game audio.

1 Like

Thanks Karatekidzz, I will immediately try to put your advice into practice. I will certainly have combined a trivial mistake, but it consoles me to know that this is a great way to learn.