Many Loca Sound Files – Memory usage

4 years 8 months ago #360 by grit
Dear support,

in my iOS app I have a lot of movie clips with long audio files. I localize the audios in 5 languages, so I have quite a lot of localized audio files (also some localized texture files). Right now I am using the I2Languages.prefab as my only loca source. Thus all my localized audio files are loaded into memory all the time. However I often need just a couple of them in each scene. I stumbled upon this other thread in this forum and read, that I could create my own loca sources inside the scenes with just the terms I need there to save memory. I just wanted to make sure:
Is it a good idea to create a loca source in each of my scenes separately, so that my localized sounds only get loaded in the scenes needed? Will they be deallocated automatically when I leave the scene then? Do I have to consider something special when creating new sources or is it just: create an empty object and add a loca source component to it and define the terms?

Thanks for advise.

Please Log in or Create an account to join the conversation.

4 years 8 months ago #362 by Frank
If you have lot of big assets that you want to localize, but not have them loaded all the time, the best approach is to place them in the Resource folder and after you add them all to your Source, just go the External Assets tab and remove them from there if they are referenced.

The plugin stores all the asset references as strings (sound name/path). Once it needs to loads a sound, it tries to find that name/path in the External Assets, if its not there, then it tries loading the sound from the Resources.

The external assets tab is there so that you could reference assets that are not in the Resources folder. Normally if you reference a sound/texture/etc if its in the Resource folder (a sub folder) it will not add it to the list, otherwise it add is automatically to the External Assets list.

If profiling in the editor, you may see all/most of the sounds as loaded/referenced because the inspector needs to preview them. But in game there shoud only be loaded when needed.

In fact, not all of the assets in the language you are currently are loaded, just the one that have been requested by some Localize component.

If when profiling you see more assets loaded than those in the current language and in use, please let me know and I will check that again.

Furthermore, you can create local sources in specific scenes. That was mainly set so that new scenes coming from bundles could bring their localization in the bundle. Those sources are not loaded until you open the scene, but they are not currently unloading after you leave the scene. I saw there is bug there preventing the unloading, will get a fix for that on the next release.

In general, is advised to keep all localization in the I2Languages.prefab as that allows the editor to correctly show which terms are missing (Used in the scene, but not in the selected source), But aside that, its fine having local sources. In fact, all example scenes have local sources to keep there only the localization needed for the particular scene.


Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The following user(s) said Thank You: grit

Please Log in or Create an account to join the conversation.

4 years 8 months ago #365 by grit
Dear Frank,

thanks a lot. I moved all my localized audio assets to the Resource folder and removed them from the external assets list. Now in my profiler only the audio assets in the current scene and only in the current language are shown. Fab!


Please Log in or Create an account to join the conversation.

Time to create page: 0.141 seconds
Template by JoomlaShine