Search Unity

Humanoid avatar auto-generation from script

Discussion in 'Animation' started by Volgix, Jul 19, 2017.

  1. Volgix

    Volgix

    Joined:
    Jun 20, 2017
    Posts:
    3
    Hi,

    When you have a model, you can manually set its animation type to 'Generic', 'Humanoid', 'Legacy' etc.

    When I select Humanoid and apply it, Unity successfully generates an avatar for my Humanoid character, and it's fine, but when I set my model's Animation type to Humanoid from script (using modelImporter.animationType), Unity does not generate/configure the avatar properly, and I get this:


    AvatarNotConfigured.jpg

    I saw that I can create an avatar from script with things like the AvatarBuilder and HumanDesription classes, but it seems that I would have to recreate the whole thing myself, while I just would like Unity to create/configure the Humanoid avatar the same way it does when I set the Animation type manually.

    Did I miss something?
     
  2. psychicvrlab

    psychicvrlab

    Joined:
    Oct 29, 2014
    Posts:
    14
    I have the same problem. Is there any solution for this?
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    You want to get at the "Enforce T-Pose" command from the avatar configuration. Sadly, that's not available from scripts.

    You can either bite the bullet, and write out a script that sets all of the transform positions and rotations correctly in the import (assuming all your models have the same values), or just live with having to set the models as Humanoid by hand.
     
  4. psychicvrlab

    psychicvrlab

    Joined:
    Oct 29, 2014
    Posts:
    14
    Uhnn...
    So, you mean there is no method to change the animation to Humanoid via script.
    A will report this (bug) to Unity to solve the problem.
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    A feature not existing is not a bug.

    The only thing that's required from Unity's side is to expose the "Enfore T-Pose" command to user scripts so it can be run during model import. Maybe @Mecanim-Dev or someone else could be convinced to do that.
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Made a Feedback entry for this. Not that I have much faith in Feedback, but oh well. Vote for it if you want to.