I am developing an arcade racing game. And I'd like to know why you'd make a prefab for every car vs creating a single prefab for all cars. Here are some examples:

Project 1: This project uses a main prefab (CompelteTank) as a Controller, managing everything, spawn, control, physics, etc. And add a Layout prefab according to the select Tank model, applying the weight by this same model id.

Project 2: This project uses different prefab for each car, I believe this follows the standard of car games like simulators.

  • 2
    \$\begingroup\$ We can not make that decision for you. You know your project and its requirements. We don't. You have already identified the pro's and con's. This is all we could have done for you. Now it's up to you to weight them against each other in the context of your project. \$\endgroup\$
    – Philipp
    Jun 13 '17 at 14:55
  • \$\begingroup\$ These facts have increased my maturity on the subject and now I left the most succinct question, to dont cause problems in the forum, and now I think the question is more useful for the forum and less referenced to my person. Thanks you, any news i post here. \$\endgroup\$ Jun 13 '17 at 16:06
  • \$\begingroup\$ Very important you know that this is not a forum. For instance, we do not engage in discussion. \$\endgroup\$
    – Gnemlock
    Jun 13 '17 at 22:50

These examples represent two common approaches. Essentially, there's a spectrum between programmatic and manual asset creation. The first project is closer to the programmatic end of the spectrum and the second is closer to the manual end of the spectrum.

Choosing between the two will depend on how you want your project organized and the level of coding you're comfortable with.

Personally, I would choose option one. There are a few major benefits with creating cars more by script than with prefab:

  1. Cars can be generated purely from an external data file. This means you (or your users) can add additional cars later on, simply by loading in new data to your "CarGenerator" prefab.
  2. Changes to scripts can be merged much easier than changes to a prefab. This is especially important when working in a team environment like you are. If two people made changes to a prefab, it's going to be harder to merge the changes between two prefabs (it gets easier by forcing text serialization in the project settings).
  3. You can more easily make changes to all your cars, by just changing one car. Consider if you created a new script that needed to be attached to cars. You'd have to attach that script to each of your car prefabs. In the case of using a single prefab that generates all cars, that's only one car prefab that needs modifying.

On the other side of things, having a prefab for each car has benefits as well:

  1. It's much less scripting work. This means it's likely faster to for a team that doesn't have a lot of coding experience to add new cars.
  2. It's less complex. You make it once and it is always going to be generated in the way you made it. This simplifies the creation of assets.

Not the answer you're looking for? Browse other questions tagged or ask your own question.