Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Animations not affecting mesh (not even in preview)

Discussion in 'Animation' started by Flavelius, Dec 10, 2019.

  1. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    Hi,
    i have this strange problem: i have an animated character split into 2 .blend files, mesh and animations;
    in a previous unity version everything was working as expected. But i recently upgraded unity (2019.2.15f1), installed blender 2.8, opened the project after some time again and now none of the animations are playing if i press play in either the preview window nor ingame, the mesh stays in a fixed pose without effect from animations at all.
    But inside blender they still run just fine.
    I already reimported both files, tried different rig types, even tried exporting the animations as fbx with the same result.
    Is there something that changed in unity, internally, that i have to adapt my files to?
    Both files have the same rig inside them, the animations file also has a simplified copy of the mesh, animations are split into NLA-clips.

    What i noticed to be different from screenshots of importsettings i found while researching the web is that my clips don't have a dropdown to select their source (their length and loop settings etc. seem to be correct though). The fbx export had it though (while still also not working). Could that be a hint towards something i missed or is that expected in certain scenarios?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    Do the animations move the bones and just not affect the mesh or do they not even move the bones?

    Do you see a reasonable amount of data if you open them with the Animation window?
     
  3. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    That's a good suggestion;
    I checked the animation window/opened the animations in it and yes, even there are keyframes with their values changing while scrubbing the timeline.
    But the names of the channels don't sound quite right. Not sure if they should be named like that, but they are atleast not the names of the bones:
    animation.jpg
    armature.jpg
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    Importing the animation with the Rig set to Humanoid converts everything to control those standard values so that the animation can be retargeted to any Humanoid model. So if your model is set to Generic then it won't be able to play any of those animations.

    Humanoid animations have an extra performance cost, so if you know the animations and model are using exactly the same Rig you should just use Generic.
     
  5. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    I tried both, generic and humanoid with both having the same result. But good to know about performance implications, thanks.
    I had a closer look at the scene. It looks like there actually is an animation playing, to my surprise, but it seems to be the idle animation toned down or trimmed or sped up, it's hard to say as it's very short and does only have very slight motions.
    The linked animator at runtime does show the transitions working as set up, to walk/run etc. but they don't seem to 'apply'.
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    Do you have their import settings set to looping?

    Do the states in your Animator Controller have their Speed set to anything other than 1?

    It might help if I can see what it actually looks like. If you download Screen 2 Gif, you can record a gif then save it and drag and drop the file in here to attach it to your post then click "Full Image" to embed the actual gif in your post rather than just listing it as an attachment.
     
  7. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    Import settings of the clips:
    clipImport.jpg
    The animator in play:

    And no, the speeds in the animator are all 1
     
  8. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    I'm running low on ideas. Try starting from scratch:
    1. Drag your model into the scene.
    2. Make a new Animator Controller and assign it to the model.
    3. Make just one state to play the walk animation without any scripts.
    4. Enter Play Mode and pray it works.
    If not, I guess you could select your model and animations then use Right Click -> Export Package and upload the package so I can take a look.
     
  9. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    When doing that it only plays the idle animation, even though the animator says "Run" is the active state (and the run animation is what i dragged in there), although it also seems sped up.
    (https://flavelius.de/files/BorkedCharacter.unitypackage)

    (Even the little preview window in the importer only plays the idle animation for every clip)
     
  10. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    I can't even import any animations from the animations file, it says it can't find the hips bone to set up the Rig properly.

    Try exporting your model and animations from Blender as FBX files. I've never used blend files directly, but I've heard that a lot of people have trouble with them.
     
  11. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    I already did that (as mentioned in the first post) with similar results, unfortunately.
    Interestingly i don't get those warnings you do.
     
  12. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    927
    Ok, experimenting with it a bit more i found that it's probably a visual bug in the importer that just doesn't correct itself, even after reimport.
    And as i've read in some threads it seems unity silently changed the way .blend files import, which means one has to manually adjust the importer script to restore the previous behaviour https://twitter.com/jotapeh/status/1176627959618330626
    So the visual bug just keeps the previously imported animations around, even though they aren't actually imported with the new importer.

    Edit: adjusting the script made them reimport fine and unity throw exceptions indicating that those ghost animations have problems - and reassigning them with the now imported ones works, so yup, that was the culprit.
     
  13. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    I should have thought of that. I've had issues in the past with models not properly reimporting when changing the file directly in Windows instead of letting Unity import another copy (which is really inconvenient because importing a copy would mean anything that references the old one needs to be manually updated to the new one).
     
  14. NirajMM

    NirajMM

    Joined:
    Jan 12, 2019
    Posts:
    1
    I had the same issue. when I was animating doorway, Accidentally I set the prefab to "Static" while creating asssets.
    So animation on static objects wont work for mesh, everything else will be affected by animation; like BoxColliders, etc.
    Hope this'll help :)
     
  15. stevekrile

    stevekrile

    Joined:
    Jul 17, 2023
    Posts:
    5

    Of for the love of pete. Thank you @NirajMM, that was it!