- Home /
Best way to setup character selector?
Hello!
I'm working on a mobile game which allows players to select the character used. For now, I place all the characters under the Player object and only enable the one selected (disable the rest).
Another way I'm thinking would be creating prefabs for each character and instantiate the one used (destroy the previous one).
Which way you think is better performance wise? Or is there any standardized way of doing this?
Thank you!
That question is as wide as galaxy :) There's no standardized anything in this business. Follow: "do -> see if it works fine". I personally recommend setting up prefabs. Say, a mage is selected, "tap Save", then at the level initializing tell your script that a mage was picked, so it could instantiate your mage.
Okay. Thank you! I think is about trade off memory vs the instantiation time. If I use prefabs, the player will experience a short loading time when changing the character ( I mean in the character menu). If I load everything and just disable the game objects, the change will be instant, but this will take up more memory having all of the characters loaded.
Don't let loading times scare you. $$anonymous$$odern machines tolerate everything. If you're concerned about what most video tutorials say, let it go, outdated. Even a year ago my PC wouldn't run something my current phone does.
Answer by theANMATOR2b · Jul 04, 2017 at 12:10 AM
Consider setting up both systems and comparing using the profiler to give you the most accurate answer. Too many variables to consider to give a definitive answer which is better for performance.