Sound on Android not run

Hi, I’m desperate,

I am testing a mobile app on the mobile and I have started to do built. In the Unity


editor everything works perfectly, but in android the sounds don’t work and they don’t do anything. Today I have done a test catching an exception and putting it in a text on the mobile and the problem is that it does not find the audio path. I have tried with a couple of audios but nothing. I don’t know if it’s not loading the banks correctly? I also did tests loading all banks by default but it doesn’t work either… I don’t know what else I can try.

I hope someone comes up with something!

Thanks a lot

Hi,

After thousands of tests I have achieved something. I had the project as a single Project and from there it was loaded directly from the android folder. I have switched to multiProject. At first it wouldn’t let me, but if I load all the banks (android and desktop) it works both in editor and in mobile. If it doesn’t work, it goes nowhere.

Any ideas?

Thanks.

What do you mean by it not letting you switch to Multi Project?
And what do you mean by loading both the Android and Desktop banks? Are you loading banks using Load Banks = All or some other way of loading banks?
Can you also please tell me what version of FMOD are you using?

Let’s see if I can explain myself, sorry.

Unity: 2020.3.23f1
FMOD: 2.01.10
macOS Catalina: 10.15.7

The program is intended only for android, that’s why initially in unity it loaded the banks with the single project option. In this option, the banks were loaded by code, and the only ones that were loaded by default were the master and the master.string.

When I tried the app already on the mobile to start testing it, I realized that no audio sounded on the mobile. I tried thousands of things, and did many tests. Until it occurred to me to change the way of loading the banks.

This is why I switched to changing the banks from single project to multi project. In this mode I initially tried to load the banks in the same way. Selecting only some specific banks and the others loading them by code depending on the scene. This way it did not work for me neither in the editor nor in the mobile.

I continued testing and tried loading all the banks from the beginning and not by code. And this way it works both in the editor and in the android.

Right now it works but I need to be able to control when the banks are loaded so that only the ones in one scene are loaded so I don’t waste resources. And really I don’t understand what is happening.

Sorry for the length and hope I was clear. I am attaching a photo to further clarify.

Thanks a lot,

Adrian.

Thank you for the additional explanation, I see what you mean now. So for some reason you are getting no sound when loading banks by code, but you are getting sound when Load Banks is set to “All”- are you using Split Application Binaries for this project? If you are then you will need to load banks asynchronously.
Otherwise, can you please share a code snippet of how you are loading banks via code?

Hi Jeff.

Split application binaries is disabled.

The script I use to load the banks is a simple script where from the editor you indicate the name of the bank and it is loaded in Awake and when you leave the scene it is downloaded:

public class ControllerSoundScenes : MonoBehaviour
{
[SerializeField]
[BankRef]
stringBank;
FMOD.Studio.Bus _maserBus;

private void Awake()
{
    LoadBank();
}

private void Start()
{
    _maserBus = RuntimeManager.GetBus("bus:/");
}

public void LoadBank()
{
    RuntimeManager.LoadBank(Bank, true);
}

public void UnloadBank()
{
    RuntimeManager.UnloadBank(Bank);
}

public void StopAllEvents()
{
    _maserBus.stopAllEvents(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
}

}

I don’t really know what’s going on. I don’t know if anything else comes to mind. For now it only works for me when load bank is set all and in multiproject.

Thanks.

Thank you for the additional information, to narrow down this issue just a little bit more, can you please test whether you get sounds working on Android if you use the FMOD Studio Bank Loader component to load banks?

Hi,

Either. It tells me it can’t find the bank. It only lets me control banks by code or through FMOD’s own Bank loader component if I’m on single platform built and select desktop. If I select mobile it also does not allow me to control them.

Now I am trying to unload all the banks when starting the app but I am finding that when I unload the banks in a scene. In that scene they are unloaded, but when it goes to another scene they are loaded again even though I haven’t loaded them.

I don’t know if when you put the mode load → all in the FMOD configuration all are loaded in each scene. And it’s in the scene where you can unload banks but you don’t save this for the next one.

Honestly, I’m a bit stuck right now.

Thanks for the time.

Thank you for giving that a shot, if it is failing to load using the FMOD Bank Loader component then I think I am going to need a reproduction to investigate further. I am finding that banks don’t get reloaded when changing scenes if Load Banks is set to “All” and I unload banks.
Would it be possible for you to upload a basic reproduction to your FMOD Profile?

Hi!

I honestly don’t really know how to read the profiler. I send you three tests in the profiler:

Profiler: 1, 2, 3

1 - MultiProject All banks loaded. At the beginning and in each scene change the banks.

2 - MultiProject selecting banks at startup. In each scene they are loaded and unloaded.

3 - SingleProject selecting banks. In each scene they are loaded and unloaded.

In the mobile it only works in miltiproject with all the banks loaded.

I send you a link to my drive so you can download them. It won’t let me send them through the FMOD page. I hope this is of some use.

On the other hand. Why is it that when you load all banks from the start, requests to load or unload other banks are ignored? Once you start the loaded banks you can no longer control them?

Thanks for your time,

Adrian.