- Home /
good resource about conserving memory when multiple levels share resources?
Hello, I've been working on a game for awhile now, and I have run into questions about memory management.
I'm looking for a good reference about conserving memory in Unity3d and can't find one. Any links/suggestions?
Specific questions: when an asset is in the hierarchy, but its checkbox is deselected, what does that mean, memory wise? Does it not consume memory until the box is checked? Or is it loaded on startup and then is merely placed in the scene when the box is checked?
The reason I ask is because I'm trying to design multiple levels in a game that reuses assets from level to level. Would it be inefficient to have GameObject containers for each level that are turned on and off? Or should I create and instantiate them through a script when appropriate? I originally was using different scenes to take care of everything, but then a lot of stuff is duplicated, and I heard that doing so leaks memory on iPhone. Is this true as of 8/21/10?
To clarify some things about the game that might help you guys let me know: it's a puzzle game, so a lot of assets are common to each level, just placed in different locations. I'm also procedurally generating a bunch of meshes per level.
Finally: I don't have Unity Pro.
Thanks guys! off topic: If you want to see the game and offer feedback, please let me know.
Jon
If you're suggesting you have every level in a single scene then I wouldn't recommend it. Loading scenes unloads unused assets so there's no memory worries there. If you wanted to save objects between scenes you can set DontDestoryOnLoad(gameObject) on it.
Hi, I'm currently using GameObject containers to hold all of the assets of each level, turning the containers on and off as needed. $$anonymous$$ost of the objects are duplicated from level to level. Is this inefficient?
Thanks
I have the same question about the checkbox selected/deselected feature and memory management, so hopefully someone can clarify what exactly happens memory wise in these cases.
Now, about having all of your assets loaded in GameObject containers for all your levels, I'm pretty sure this isn't a good thing. You say you have lots of duplicated content between your levels, so you should be using prefabs for all those assets! Don't just duplicate them, create prefabs and re-use those, and use different scenes for your levels :)
Your answer
Follow this Question
Related Questions
Enter next level 1 Answer
memory management strategy 0 Answers
Load a scene/level when enemy is close... 1 Answer
How to keep count of enemies left 2 Answers
How to restart a "prefab'd" level? ;) 0 Answers