Equip Item optimization

Hi. I’ve made a character with different armour, and I’ve used the GameObject.active option to show and hide the different armour. I am just wondering if this was the most efficient way to display different equipment on characters, or if there is a better way? Should I destroy and instantiate the items instead? By hiding the items, will it slow down the game play? Any help would be appreciated, thank you.

I’m just guessing here, but my take on it is that to use an asset it has to be in memory (unless you load it dynamically at the point you need it).

Unity will load it in for you if it is part of the current scene, and if its in memory it would be easier to hide and show it, rather than keep loading and unloading it (destroying it). If it’s not in the render pipeline, (i.e. its hidden) it won’t affect your fps I shouldn’t think and therefore won’t slow your gameplay down.

However, if you have lots and lots of objects, (and I guess I mean hundreds or even thousands) maybe lower end machines would run out of memory and disk swapping would slow your game down.

With 2.1 you can bundle assets and load them as required, so maybe that is an alternative, if you are thinking of having hundreds of items. Of course that means players have to wait - so I guess it will be a balance for each situation requirement.

IPete2.

Thanks for the quick response pete :smile: I’ll play around with hiding stuff a little more and try to find out as well.