|
Post by alancstone on Jun 30, 2014 1:20:04 GMT
We're running out of memory and while using the Untiy Editor profiler I noticed that MasterAudio uses a lot. AudioClips took up 300 MB and MasterAudio took up 180 MB. I need to reduce the amount of AudioClip memory via compression and dynamic resource loading, but I'd like to know why MasterAudio takes up so much memory according to the profiler.
Since most of the AudioClips that were only referenced by MasterAudio are in the AudioClips section of the profiler I'm confused why it would need to allocate runtime memory for them as well. I am unable to see children of the MasterAudio allocation to confirm this but I assume the memory must be allocated for AudioClips since there can't be that much meta data.
Can you clarify why the Profiler would show 180 MB for MasterAudio?
Also, can you clarify this bit of your 'tips and tricks' post:
I've noticed that the Unity Editor profiler shows a lot of memory allocated for AudioClips that are marked as streamed. Is the profiler showing memory allocated when it is not? Or does a scene always load audio clips into memory when playing from the editor?
|
|
|
Post by DarkTonic Dev on Jun 30, 2014 5:29:03 GMT
Regarding this part: "although the profiler doesn't show this correctly", you cannot trust what the Profiler says about streaming audio clip memory allocation while running the game in Unity. It's way overestimated. You have to profile the game running on the actual target device to get a more accurate memory usage. If you don't want to bother with all that, just go ahead and set up the music as resources. However that does have a higher memory usage because Unity doesn't actually allow streaming from Resource files. The scene does not always load the streamed clips into memory. Instead, it shows much higher memory usage from streamed vs non-streamed clips (which is very incorrect on the target device).
All non-Resource clips you configure in the Master Audio prefab will take up memory the entire time the Master Audio prefab is in the Scene, just the same as if you added the audio clips to scene objects (which is actually what is going on) inside the Master Audio prefab.
If you have more than a couple songs in your Playlists, even if they're streaming, they will all take up big chunks of memory in the profiler. I would recommend trying to set them all as Resources and then close and open Unity and profile again (more on this below).
I actually have no idea what you mean by MasterAudio taking up RAM. Are you confusing that with "Audio Manager", which is a Unity thing? If not, please share a screen shot of what you're seeing. And make sure to close Unity and open it again before taking the screens shot of the Profiler. I noticed that the Unity 4.5 Profiler doesn't seem to register a lot of changes until you do that.
Also, are you on the newest version of Master Audio? And what version of Unity are you on?
|
|
|
Post by alancstone on Jun 30, 2014 6:51:49 GMT
Ah, you are right, I somehow confused AudioManager with MasterAudio. So it must be Unity overhead of some sort.
Thanks for the additional information about the profiler and streaming audio, and the warning that resource files cannot be streamed since I was about to try that. My plan is to make the really big audio files streamed, make the smaller but less common audio files resources, and keep the small common ones loaded into memory.
That is all I needed to know, but FYI I'm on Unity 4.3.4f1 and MasterAudio 3.5.3.9.
|
|
|
Post by DarkTonic Dev on Jun 30, 2014 6:54:29 GMT
Sounds like a good plan! Yes AudioManager is built-in Unity overhead stuff.
If you have more than a couple songs in your playlist and they aren't humongous, it's sometimes better to just load them into memory as Resources. You might want to try both ways and monitor the memory usage (on the device) if you have time.
|
|