Answered
0
0

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

}

  • You must to post comments
Best Answer
0
0

If the parameter name does not match a parameter of the event, you will get “ERR_EVENT_NOTFOUND”. Everything else looks to be fine if event starts and plays.

  • You must to post comments
0
0

Thanks for getting back to me.

After further tinkering I realized that I was creating 2 instances of the same fmod event in 2 different scripts. Once I got rid of one of them, the other script’s .setParameterValue calls worked…

Is this expected behaviour? I’ve worked around the issue and have unblocked myself but I could foresee myself creating multiple instances of the same fmod event in the future…

  • Cameron Baron

    Yes, there will times when you may want to have multiple instances of an event.
    Unity’s console can be used to pinpoint exactly where the error is coming from including the specific gameobject.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.