1
\$\begingroup\$

Lets say we are making an RTS and at runtime a unit can go from worker to soldier to baker to forester to male to female and so on, you get the idea.

This requires several different character models. Our current approach to this is to "merge" the models under on main object and have them share a rig since they share proportions. This approach lets us simply active/disable the model we need at runtime, and lets us easily set up a new prefab by just picking the correct model. I see some limitations to this approach, for example when we need other proportions later we will need a different avatar (fat, skinny etc).

Is there a better way? What is the "standard"?

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Why not simply delete/recycle the unused mesh renderer and spawn a new one? That way you're paying no memory or processing costs for a bunch of non-visible objects. \$\endgroup\$
    – DMGregory
    Oct 11 at 17:07
  • \$\begingroup\$ @DMGregory you mean destroying/Instantiating at runtime? i.e one object for each model/rig/avatar \$\endgroup\$
    – Majs
    Oct 11 at 17:56
  • \$\begingroup\$ That's an option. \$\endgroup\$
    – DMGregory
    Oct 11 at 17:57
  • \$\begingroup\$ @DMGregory True, the only "issue" that would lead to is having to assign items on all rigs. Atm I place items on the "hand" bone so that it follow animations properly. Thanks for the advice! \$\endgroup\$
    – Majs
    Oct 11 at 17:59
1
\$\begingroup\$

For this case you can use the same rig for all models, so when the "role" of the character changes you can just enable a different mesh included in the same hierarchy

Character

  • ---> Rig
  • ---> MeshWorker
  • ---> MeshSoldier

At this point you can and already is, avoiding instantiations, pools, is faster, not overload and you have to work with only one rig and avatar.

For the problem with a different avatar the approach (I) recommended is to use something like a on-the-fly-character system, so you will use another complete different character which you can instantiate or just pick from your pool of "FatWorkers", repositioning in the place of the other character which will be hide and added to the other pool.

\$\endgroup\$
2
  • \$\begingroup\$ So basically a combination of the system I am already using with a pool of Characters for when I need to chagne avatars? \$\endgroup\$
    – Majs
    Oct 11 at 17:57
  • \$\begingroup\$ Yeah! I think that's the way. \$\endgroup\$
    – Ricna
    Oct 11 at 19:20
0
\$\begingroup\$

Depending on your needs for characters of different proportions, wardrobes, hairstyles, etc, UMA (Unity Multipurpose Avatar) might be an option worth checking out. Setting up "races" is kind of a pain, but once done the system is quite flexible and does some very clever things with texture atlasing and mesh hiding to name a few.

This makes it possible to easily create hundreds of characters all sharing the same "DNA" but with endless variation (fat/ skinny, skin color, hair, you name it). In your scenario, your individual characters can then quite easily change wardrobe items at runtime to assume the different roles you require. Each character is distilled down to as little as one SkinnedMeshRenderer (depending on warddrobe materials) and packed on the fly to a single texture atlas.

UMA 2 on Asset Store (free)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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