Best way of creating lists of people

I expect this must have been covered somewhere, but I haven’t been able to find an answer to my question, partly because I’m not sure how to search for it.

So I’m creating a sort of rts, and I would like my characters to have individual attributes. So I have a prefab with a class attached which allows me to give the character a name, speed age, wage, ect. These characters get created during the game.

Now say when the user goes to create one, they get a choice of different people, all with different stats. What is the best way of creating all these people?

I could create a whole load instances of the prefab in the editor, all with the individual stats, and unhide them when the user “creates” them. But if I say had a choice of 40 people, and thats just for one type of character then, to me it feels like a bad way of doing it. I’m fairly new to unity and game development, and I wondered how other people would tackle this? All I need is a list of properties for each person, which i could then apply to the prefab properties. Does any one have any ideas or good links to examples?

thanks

Phil

Generally speaking you shouldn’t Instantiate during gameplay because it is performance expensive, however in your case I imagine that this is going to be fine due to the way your game works - it won’t take “that” long to do.

Normally you would create a series of candidate prefab instances in code as the level loads, deactivate them and then make them active when you need them. You could indeed do this and then refill your used candidates over a number of frames to stop there being too many instantiations at once - but only both with this if you are going to potentially create a lot of them in a single frame.

You can probably just fill out those stats on an stored object too - it’s the rest of creating a instance that is in any way expensive (loading meshes and materials etc).