Runtime manager: set guid

hi all!
I have this question:

I load the bank using RuntimeManager.StudioSystem.loadBankFile(... and after I wish, having a proper GUID, set the relative event to my StudioEventEmitter monobehaviour… what’s the right way to do this?
thanks

After loading a bank file, you can get the guid of that bank with Bank.getId(out guid), but this will only be the guid for the Bank, not any events inside the bank.
If you wanted to get an event from a bank and pass it’s Guid to a StudioEventEmitter, you could use Bank.getEventList(out EventDescription[]) to get all of the events contained in that bank.
From there you can choose an event description and get the event’s guid using EventDescription.getID(out Guid), and then you assign that guid to the StudioEventEmitter.Event.
We have a basic scripting example on how to manually handle events, I recommend checking it out if you haven’t already!

thank @jeff_fmod !
something is working: but the samples have all the code ‘obsolete’, like your suggestions…

is there a way to avoid at startup these errors (the banks are loaded runtime, so no files in the Build path

You can disable errors altogether by setting the Logging Level to “LOG” in the FMOD Settings, but I think the best thing to do would be to query the file’s existence using System.IO.File.Exists(String) before attempting to load it with loadBankFile.

thank you!
but the issue is not solving checking if the ‘runtime file exists’, but is due by the folder configured in the settings is empty

Thank you for clarifying, I see what you mean now by no files in the Build Path now. Unfortunately there must be at a Master.bank and Master.strings.bank file present for the FMOD Unity Integration to behave correctly.
You could potentially export blank Master and Master.strings banks from FMOD Studio just to get the bare minimum functionality and then load your other banks at runtime from a different path with loadBankFile?

it doesn’t work, seems that if I put an empty master bank and after I load from file the right bank, it mantain the old loaded bank…

It looks like the events are being called before the banks have finished loading.
When are you loading your banks and when is the event being called? If you are loading banks in the same lifecycle call that you are playing the events in then there is no guarantee that the banks will have finished loading.
I suggest you try loading your banks in void OnEnable(), and setting your StudioEventEmitter’s Play Event to “Object Start”. For example:

using System.Collections.Generic;
using UnityEngine;
using System.Runtime.CompilerServices;

public class LoadBanks : MonoBehaviour
{
    List<FMOD.Studio.Bank> banks = new List<FMOD.Studio.Bank>();

    void ERRCHECK(FMOD.RESULT r, [CallerLineNumber] int lineNumber = 0)
    {
        if (r != FMOD.RESULT.OK)
        {
            Debug.LogError(r.ToString() + ": " + lineNumber);
        }
    }

    void OnEnable()
    {
        FMOD.Studio.Bank b;

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/Master.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/Master.strings.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/Music.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/SFX.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/Vehicles.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);

        ERRCHECK(FMODUnity.RuntimeManager.StudioSystem.loadBankFile("Assets/Banks/Dialogue_EN.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out b));
        banks.Add(b);
    }

}

If that doens’t work for you then would you be able to please share a code snippet so I can help you figure out what’s going wrong?