Best method for swapping equipment - Instantiating vs Activation

Ok, so I have about 50+ pieces of equipment for my character to swap out. Which method would be better: Making all the items children of the player and having them deactivated by default (then just activate them as they are equipped), or instantiate the equipment as needed and attach it as a child, then destroy it when unequipped.

My first thought was the ‘activation’ method, but I’m a bit worried about having that many items attached to the player. Would that hurt performance in any way? What are your thoughts on this?

instantiate when first equipped, then deactivate when unequipped. Re-activate rather than re-instantiate when re-equipping (should be easy to do if you have a script keeping a List of currently instantiated equipments).

As far as I know it will only impact memory footprint but not much else since rendering and monobehaviours are disabled.

I am not sure to have the answer, but what I can tell is that you probably need to take into consideration which platform you want to develop on and how far you are planning to move on with your setup.

  • On IOS / Android, you have limited memory (compared to PC / xbox / ps3), so if you develop on PC, maybe you don’t really care, as the gain will probably be really low if you Instanciate or put all the objects as children.
  • Are you planning on using hi-res textures and models ?
  • You have different way to optimize your setup:
  • Are you using the same mesh but different texture?
  • Do you plan to use an atlas for your equipment texture?
  • Do you plan to expand your equipment ? (+200?)
  • Do you plan to keep your assets low res?

I know instantiating is not recommended on IOS and Android.

Hope it helps a bit.

They are low poly models and fairly small textures. I’m planning on making this a stand-alone PC game, so I guess I could do it either way, but I prefer to do everything as efficiently as possible.

@DoomSamurai
I like that idea. That may be the balance I’m looking for. Thanks :slight_smile:

1 Like