I’m working using Fmod 10906. I’ve created a script which I have pasted below. Basically I’ve got a music event which the script starts and then sends parameter messages to. The music events starts up fine but the parameter value don’t do anything.
I’ve determined that the musicEvent.setParameterValue call is returning 'ERR_EVENT_NOTFOUND" which seems weird as the musicEvent.start call clearly did find it.
I also had similar issues with another project which had been working fine in 10904 but had issues in 10906 - The parameterValues stopped working (everything else was fine)
Any help would be greatly appreciated!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MusicControl : MonoBehaviour {
[FMODUnity.EventRef]
public string music = "event:/Music";
FMOD.Studio.EventInstance musicEvent;
// Use this for initialization
void Start ()
{
musicEvent = FMODUnity.RuntimeManager.CreateInstance (music);
musicEvent.start();
}
//Player has clicked "Play Now"
public void GameStartedMusic()
{
musicEvent.setParameterValue ("GameStarted", 1f);
print("GameStarted");
}
//Player is at less than 50% health
public void IsUnderHalfHealthMusic()
{
FMOD.RESULT result = musicEvent.setParameterValue ("IsUnderHalfHealth", 1f);
print ("IsUnderHalfHealth");
print (result);
}
//Player health <= 0 AKA GameOver
public void IsDeadMusic()
{
musicEvent.setParameterValue ("IsDead", 1f);
print ("IsDead");
}
}