Hello Guest

Author Topic: in-game menus and memory management  (Read 4396 times)

asea19

  • Newbie
  • *
  • Posts: 5
    • View Profile
in-game menus and memory management
« on: February 03, 2013, 11:09:14 pm »
Hi,

I love your software.  I am putting together a menu and GUI with it now and had a question about an approach to creating menus that are easily accessible from the game with little transition time.  I am concerned the impact on memory when having all the 2d assets in the scene(deactivated) during the gameplay.

For example for the player selection screen, it will have a background image(1136X640) and a character portrait(640x640) placed in front of the background, and a few other small buttons and textfields.  There are 8 possible characters.  I would like the user to be able to access this menu fairly quickly from within the game. So, I'm wondering, for memory management purposes on mobile devices, what do you suggest?  Should I place all of the images visually in my scene and activate/deactivate them when needed?  Or, should I place them all in my resources folder and load/unload them when needed.  I have seen the loading/unloading can be pretty ugly on mobile, but I am also concerned about having all these images hanging around in memory in the background while my game is running.  I appreciate the help!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: in-game menus and memory management
« Reply #1 on: February 04, 2013, 11:00:34 pm »
Easy way to do this...

1. Create a second scene with all the UI stuff set up. Make sure the entire second scene is parented to one object to make it easier in the next steps.

2. Use LoadLevelAdditive / LoadLevelAdditiveAsync to load this level in, and do what you need to do here.

3. When done, delete the one object which contains this scene.

4. Call Resources.UnloadUnusedAssets to remove the stuff.

asea19

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: in-game menus and memory management
« Reply #2 on: February 14, 2013, 08:41:07 pm »
Hi, thanks for your suggestion.  I have implemented something like this and so far so good.