Hello everyone, apologize if this question is rudimentary. I have searched the forums and scoured all tutorials I could find and it is still not working. I am a beginner with FMOD and Unity so again apologize.
I have created Events, I can call them from Unity to get them started and pass the various parameter values during that start call. However, no matter what I try I can’t seem to
1- Update the parameter values correctly
2- Stop the event instance when needed.
Below is a sample of my code that myself and my programmer have created in a basic test scene to try to understand what we are missing and what we are doing wrong. Any help at all would be massively appreciated.
Thank you!
using System.Collections;
using System.Collections.Generic;
using FMODUnity;
using FMOD;
using FMOD.Studio;
using UnityEngine;
[CreateAssetMenu(menuName = "ScriptableObjects/AudioManagers/Test")]
public class TEST_FmodAudioManager : AudioManagerSO_Base
{
FMOD.Studio.Bus MasterBus;
public FMODUnity.EventReference _E5CircusIntroMus; //Fmod Event
private FMOD.Studio.EventInstance m_E5CircusIntroMus; //Fmod Emitter
[SerializeField]
[Range(0f, 1f)]
public float Level = 1f;
public float paramFloat;
public void TestCall()
{
paramFloat = Level;
CallFmod(m_E5CircusIntroMus, _E5CircusIntroMus, "E5_CircIntro_K", 1, "E5_CircIntro_Vol", Level, "E5_CircusIntro_Switch", 1f);
MasterBus = FMODUnity.RuntimeManager.GetBus("Bus:/");
m_E5CircusIntroMus = FMODUnity.RuntimeManager.CreateInstance(_E5CircusIntroMus);
}
public void TestUpdate()
{
UpdateFmod(m_E5CircusIntroMus, "E5_CircIntro_K", 2, "E5_CircIntro_Vol", 0.1f, "E5_CircusIntro_Switch", 1.0f);
//m_E5CircusIntroMus.setParameterByName("E5_CircIntro_K", 1);
//m_E5CircusIntroMus.setParameterByName("E5_CircIntro_Vol", 0.25f);
//m_E5CircusIntroMus.setParameterByName("E5_CircusIntro_Switch", 0f);
}
public void TestStop()
{
m_E5CircusIntroMus.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
//MasterBus.stopAllEvents(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);// THIS WORKS
m_E5CircusIntroMus.release();
}
}