Answered
0
0

Hi,

I’m trying to learn how to add FMOD into games and how to code this so have got the Viking Village loaded up and am putting FMOD into this.

My current venture is to get an FMOD event to have its parameter changed without using the normal way of using triggers; I would like to change the parameter in code so it can react to the player pressing a button or waiting a certain amount of time. Right now I just want it to change to the player pressing a key on the keyboard.

I have a box with an event playing (using the event emitter) and have a script added to this object which is where I want to change the parameter. I’m very new to coding so only know how to make the code react to the player pressing a button, not having the code get the playing event and then change its parameter.

Any help would be appreciated.

Thank you for your time.

  • You must to post comments
Best Answer
0
0

[FMODUnity.EventRef]
public string NAME EVENT = “event:/EVENT”;
public FMOD.Studio.EventInstance AUDIO EVENT;
public FMOD.Studio.ParameterInstance PARAMETER EVENT;

void Start () {
AUDIO EVENT = FMODUnity.RuntimeManager.CreateInstance(NAME EVENT);
AUDIO EVENT.getParameter(“NAME PARAMETER FMOD”, out PARAMETER EVENT);
AUDIO EVENT.start();
}

void OnTriggerEnter(Collider other)
{
PARAMETER EVENT.setValue(VALUE IN FLOAT);
}

  • James

    Thank you for the answer!

    It all works (minus setting 3D attributes which is a separate issue) but it creates a new instance rather than changing one that’s already been made. Is there a way to do that or should I get rid of the event emitter and use this script only?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.