Will setting actor's height and width to 0 save memory?
AlkaPP
Member, PRO Posts: 194
Hi all,
I'm working on all levels in one scene project. Many actors are not used sometimes when they're not on camera but they can't be destroyed.
If I set them to 0 when not in used, would it save memory?
Any suggestions on all in one scene? It's a hundreds levels game so I don't think I would make separated scene for each level.
Thank you,
Alan,
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
Comments
now this is an interesting question. i'd like to know the answer too.
Likewise!
If it does save memory, would it be prudent to have ALL (or most) actors set to 0px, simply changing the values to the desired size with a 'Change Attribute' behavior at the top of the actors?
Has anyone tried this theory out? I like the idea of saving memory this way...
My Viewer is not working or else I can test it. It seems to be a very easy test since all we need to do is to add like 20 actors with size like 100-200 and then change their sizes to 0 and compare the memory. But too bad I can't get the GS Viewer to work. It's stuck at loading scene.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
I see no change in memory usage in my testing, but actors themselves take up very little memory anyway. I'd be surprised if this had any meaninful impact - the actor itself is still there, any images they use are still there, all the logic in them are still there. Memory only tends to be an issue if you have excessive amount of logic or images. Number of actors has a much smaller impact.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline thank you for testing it. I was about to today after finally found out that the Viewer not working just because my Firework blocks GS connection.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
Setting your actor as invisible is much more efficient than scaling it to 0. If your actor does not need to be seen then you can optimize your game by setting it non visible. I believe it completely disables the renderer (not sure), but according to GS documentation it saves performance. Do not change the alpha to 0.(since doing that will still force computation on the GPU). Just tick visible off.
Visible can not be changed during the runtime. The actors will need to be seen and hidden according to the level. Ticking visible off is only used for those actors that don’t need to be seen the whole time.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1