- Home /
Questions for ram memory management in unity
Hi, I fighting with ram memory usage in my project. I have a lot of objects on my scenes (many big scenes in build) with many meshes with high resolution textures.
I working on few systems and trying to reduce memory but without big success. Biggest thing I did is system which takes all objects from scene with component which defines how object is visible in scene (small, medium, big, very big) then creating empty object which holding reference to prefab etc. so scene is only terrain and empty objects with components with references to prefabs. When I load scene all components are grouped and prefabs are created only when they are needed (because I saw, destroying object will only unload assets with UnloadUnusedAssets(), but maybe prefab reference in component will not allow to? :( ) I using it with UnloadUnused assets, it shows very big dirrence in memory profiler in unity editor (meshes memory goes down from 1.1gb to 300mb) and on build with menu and one scene from this big ones, memory usage is very small (800mb) when with all scenes it's above 3gb.
Can't figure out how unity memory management really works. Now I found option in memory tab in profiler, it's "Detailed" button (first there is text "Simple") and there I can see more info about memory, thanks for it I optimalized some audio things, but there is mysterious thing in "Other" category, called "Objects" and it takes 1.81gb and no info, no references are given.
Sometimes on build everything taking 1.7gb and sometimes above 3gb depends of build's mood :O
What can I do to reduce memory in my project? :(
Thanks for "Detailed" I found few textures which aren't compressed and took about 1gb memory, but I see many textures aren't unloaded even they arent used in any material and object in scene. But this memory which is viewed in this tab corespondence in build ra memory? Maybe it's file size in project directory resources files. I making builds for windows.
Thanks, this probably will help some, is there maybe more and more in depth about optimizing ram memory usage in unity?