Hi.
Im trying to store the EventInstance in the list after creation of the event , but error pops out NullReferenceException . I can start the event and it starts playing , but after i cant add it to the list.
What version of the FMOD Unity integration are you using?
Could I get the full script to test on my end?
I was able to add events to a list using the following code:
private List<FMOD.Studio.EventInstance> eventList = new List<FMOD.Studio.EventInstance> ();
// Start is called before the first frame update
void Start()
{
eventList.Add(FMODUnity.RuntimeManager.CreateInstance($"event:/Music/Level 01"));
eventList.Add(FMODUnity.RuntimeManager.CreateInstance($"event:/Music/Level 02"));
for (int i = 0; i < eventList.Count; i++)
{
eventList[i].start();
eventList[i].release();
}
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
for (int i = 0;i < eventList.Count;i++)
{
eventList[i].stop(STOP_MODE.IMMEDIATE);
}
}
}