Search Unity

Animating multiple character models (one at a time) using a single Animator.

Discussion in 'Animation' started by katsuragi545, Nov 23, 2019.

  1. katsuragi545

    katsuragi545

    Joined:
    Jun 25, 2014
    Posts:
    38
    I'm working on a game where the main character has several classes they can be: Fighter, Brawler, and Mage. Each of these classes have a different 3D model (skeletal structure is the same but I expect that to change in the future). I want to give the player the ability to switch between each class at runtime by way of a pause menu.

    Right now I have a character gameobject with a "CharacterMeshes" child. "CharacterMeshes" contains the Animator component and a script to handle animation events. Under "CharacterMeshes" I have child objects for each 3D model for Fighter, Brawler, and Mage - during gameplay only 1 is active at a time. My game object hierarchy is setup like:

    MainCharacter
    -> CharacterMeshes
    -> fighter3Dmodel
    -> brawler3Dmodel
    -> mage3Dmodel

    How would you go about switching between the 3 different models and allowing the animator to control the active one? Right now, the animator works fine against the default model (fighter), but when I deactivate it and activate one of the other two, in no longer animates - the model just stays in the original T-pose. No errors are thrown either. They all have the same avatar definition, set to humanoid, and all work fine when there is only 1 under "CharacterMeshes".