BankLoadException: [FMOD] Could not load bank ‘J:/FMODProject/Genesis/Build/Desktop/SFX.bank’ : ERR_INVALID_HANDLE : An invalid object handle was used.
int maxchannels = 128;
RuntimeManager.StudioSystem.initialize(maxchannels, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
TextAsset bankAsset = ResMgr.Instance.LoadSync<TextAsset>("Assets/Res/Sound/Fmod/SFX.bytes", out var outAREx);
RuntimeManager.LoadBank(bankAsset);
int maxchannels = 128;
RuntimeManager.StudioSystem.initialize(maxchannels, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
TextAsset bankAsset = ResMgr.Instance.LoadSync<TextAsset>(Common.RES_ROOT_PATH + "Sound/Fmod/SFX.bytes", out var outAREx); //bankAsset.text is bank stub:SFX
RuntimeManager.LoadBank(bankAsset);
In the documentation I linked in the previous post:
It has information about the bank stubs, in summary: “At build time, each asset is filled with the actual bank data for the build platform, so it can be included in the build. When the build finishes, each asset is reset to stub data.”
The stub will get filled with data at build time thus causing the difference in size when viewed in the asset browser.
Would it be possible to see the full script you are using to load in the bank stubs?
This is an initializer function and is called by the class when building the project.
Apologies, I missed this before:
int maxchannels = 128;
RuntimeManager.StudioSystem.initialize(maxchannels, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
TextAsset bankAsset = ResMgr.Instance.LoadSync<TextAsset>(Common.RES_ROOT_PATH + "Sound/Fmod/SFX.bytes", out var outAREx); //bankAsset.text is bank stub:SFX
RuntimeManager.LoadBank(bankAsset);
A couple of things to change here:
Could you please elaborate on why you are initializing an FMOD system here? There should already be one created by the integration.
The line RuntimeManager.LoadBank(bankAsset); may be trying to load the TextAsset before it is ready. I would suggest creating a coroutine using while(RuntimeManager.AnyBankLoading()) yield return; to make sure that all banks have loaded before trying to continue.
Again, could I suggest trying to use the code I provided above:
Thanks for your reply, I will check my code and don’t initialize manually anymore.
But before that, there is already a problem with generating the Bundle package, and I need to find a way to solve the problem of generating the Bundle package.
Because the function registered by Fmod has not been called, I manually call CopyToStreamingAssets and UpdateBankStubAssets, but the size of the generated bundle file is still wrong
Would it be possible to get a stripped-out Unity project and the FMOD Studio project uploaded to your profile? You will need to register a project with us to do so. This will allow me to test the issue on my side where I can step through the code.