# Runtime manager: set guid

**URL:** <https://qa.fmod.com/t/runtime-manager-set-guid/17690>\
**Category:** Unity\
**Tags:** csharp\
**Created:** [September 20, 2021, 5:41pm UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690 "2021-09-20T17:41:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghiboz](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ghiboz/32/46_2.png) [@ghiboz](https://qa.fmod.com/u/ghiboz)\
**Post date:** [September 20, 2021, 5:41pm UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/1 "2021-09-20T17:41:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 21, 2021, 11:10pm UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/2 "2021-09-21T23:10:18Z")

</div>

After loading a bank file, you can get the guid of that bank with [`Bank.getId(out guid)`](https://fmod.com/resources/documentation-api?version=2.00&page=studio-api-bank.html#studio_bank_getid), 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[])`](https://fmod.com/resources/documentation-api?version=2.00&page=studio-api-bank.html#studio_bank_geteventlist) 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)`](https://fmod.com/resources/documentation-api?version=2.00&page=studio-api-eventdescription.html#studio_eventdescription_getid), and then you assign that guid to the [`StudioEventEmitter.Event`](https://fmod.com/resources/documentation-unity?version=2.00&page=api-studioeventemitter.html#studioeventemitter_event).  
We have a [basic scripting example](https://fmod.com/resources/documentation-unity?version=2.00&page=examples-basic.html) on how to manually handle events, I recommend checking it out if you haven’t already!

---

<div class="post-metadata">

**Author:** ![ghiboz](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ghiboz/32/46_2.png) [@ghiboz](https://qa.fmod.com/u/ghiboz)\
**Post date:** [September 22, 2021, 6:33am UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/3 "2021-09-22T06:33:33Z")

</div>

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

[![](https://i.imgur.com/pe0j840.png) ](https://i.imgur.com/pe0j840.png)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 22, 2021, 11:02pm UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/4 "2021-09-22T23:02:56Z")

</div>

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)`](https://docs.microsoft.com/en-us/dotnet/api/system.io.file.exists?view=netframework-4.7.2) before attempting to load it with `loadBankFile`.

---

<div class="post-metadata">

**Author:** ![ghiboz](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ghiboz/32/46_2.png) [@ghiboz](https://qa.fmod.com/u/ghiboz)\
**Post date:** [September 23, 2021, 6:04am UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/5 "2021-09-23T06:04:50Z")

</div>

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  
[![](https://i.imgur.com/h16fzMV.png) ](https://i.imgur.com/h16fzMV.png)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 23, 2021, 6:22am UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/6 "2021-09-23T06:22:17Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![ghiboz](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ghiboz/32/46_2.png) [@ghiboz](https://qa.fmod.com/u/ghiboz)\
**Post date:** [September 23, 2021, 7:10am UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/7 "2021-09-23T07:10:32Z")

</div>

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…

[![](https://i.imgur.com/bbZqdeq.png) ](https://i.imgur.com/bbZqdeq.png)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 27, 2021, 12:34am UTC](https://qa.fmod.com/t/runtime-manager-set-guid/17690/8 "2021-09-27T00:34:45Z")

</div>

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:

```auto
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?
