Design Best Practice Question

Hi, In my 2D game, the player can have one of many different robot followers. Each Robot will have a variety of diferent abilities and exist as separate gameOjects currently. Right now, I have about 10 different potential followers.

If I want my player to be able to choose one of these robots to follow them, do I need to include ALL 10 game objects in the scene, and activate only the one that was selected? Or can I dynamically add only one to the scene after the player selects it.

Question Part 2:
Are there performance issues related to have many elaborate inactive gameobjects attached to a scene? Is it ok to add any number of gameojects, so long as they are not active, performance will not be impeded.


If all the robots are active during the choosing stage and they all have scripts that do lots of updates every frame, then yes I think that would have an impact on your performance.

As for performance issues while they are inactive, I found this article:

And for how I would deal with this issue:
I would have a script that just turns off all the scripts that are not needed on the robots during the choosing stage.

Then once the choosing stage is over; destroy all the robots that the player has not chosen and activate the needed scripts on the chosen robot.

If you need to go through the choosing stage more than once without reloading the level (ie: the choosing stage is in the same level file as the gameplay stage) and you are worried about performance, I would not just destroy the robots but use object pooling instead.

Hope that helps! Let me know if I did not answer your question correctly or you need more explanation!