Search Unity

Blender animation problem

Discussion in 'Asset Importing & Exporting' started by Alec, Feb 14, 2009.

  1. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    It seems that the only animation my object plays is the one that I save before quitting blender. eg I save it when I have reload selected in the action editor, all the objet plays is reload, if I save on walk, when I call for the reload animation the object play's the walking animation.

    Why is this happening?
     
  2. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    If you are building your animations only at the Action window, not the NLA window, I can only think of 2 things which could cause this problem. First, if you are exporting to fbx explicity from Blender, there is an option at the exporter window to let you choose between exporting only current animation or all of them. Second, if you have changed the default importing options in Unity for the model and you have disabled the "split animation into multiple clips" option.
     
  3. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    cheers Gus I'll see if that worked.
     
  4. dawvee

    dawvee

    Joined:
    Nov 12, 2008
    Posts:
    276
    I've just been having the same problem with a project and I have to say, this one has me a bit stumped. I'm splitting the clips on import, Unity is recognising the clips at least by name, listing all the correct clips in the inspector for the model. No matter which animation I call, though, it plays the same animation - the one that was active when I last saved the file in Blender.

    The strange thing to me is that it's actually recognising the length of each clip correctly - so to use Alec's example, if 'reload' is 0.5s long and 'walk is 1.0s long and I play 'reload', it will play 'walk' for 0.5s and stop. Unity tells me it's playing 'reload' by the isPlaying property, etc., but it's not the right animation.

    I've checked it against other Blender models that have animated with no problems and I can't find any obvious difference in any of the settings in Blender or Unity. Very frustrating!
     
  5. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    I agree Unity has actually got really poor import problems when it comes to blender.
     
  6. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    If you can post an example of a blend file producing this odd behaviour, I will take a look.
     
  7. dawvee

    dawvee

    Joined:
    Nov 12, 2008
    Posts:
    276
    Thanks, will do that tonight when I'm at my regular computer.

    To explain a bit further, I've successfully imported many models from Blender before and had no problems with the animations. The only difference I can think of in this case was that the artist who made the animations is new to Blender and created each animation in a different copy of the .blend file (i.e. he didn't know how to create a new action strip).

    I had appended the action strip from each file he sent me to one .blend file, renamed the animation strips appropriately and imported that file to Unity. I don't see why this would have caused the problem though, as all indications from within Blender (i.e. in the Outliner/OOP Schematic, IPO Curve pane, Action Editor, and so on) are that once appended they're just regular action strips, identical to any on other models that work.

    I've checked my script in Unity as well and on any other model I've tried it works exactly as intended.

    What baffles me is, as I said in my last post, it's importing each animation with the correct name and the correct number of keyframes, it's just importing the *wrong* keyframes for every animation except the one active when I last saved in Blender.

    The only thing I can think of is that there's some unique ID on each action strip and, since they're all essentially clones of the same strip, they all have the same ID and so the importer figures they're all using the same keyframe data. But then I kind of doubt that Alec's model was animated in a similarly unlikely way, so that doesn't seem altogether plausible.
     
  8. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    I suspect your artist somehow linked the action to the NLA timeline on the original file. Then he duplicated it, so all his files had this condition. As you used one of those files to import all the other animations, your final file still has the condition of linking to the NLA timeline just the currently active Action. And this could somehow affect the fbx exporter in Blender. Unfortunately I have not used the NLA stuff for a long time and I cannot remember clearly where/how to disable this condition, but take a look if you found it.
     
  9. dawvee

    dawvee

    Joined:
    Nov 12, 2008
    Posts:
    276
    Here's the .blend file that's been giving trouble. I won't be able to do much testing myself in the next week, but if you could even just verify that I'm not crazy and it really isn't working, I would appreciate it!

    The animations are very simple though, so I may just see if the artist can just re-do them in one file to see if that helps.
     

    Attached Files:

  10. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Open the Blender file, go to an outliner window and select the "Deform" Armature. Then go to a 3D window and unhide it (alt - H). Now delete it, and then try again the animations to see how they are still there, just like they were before. I guess it could be a rest of some preliminary work...? Now save and try it again inside Unity, it works just fine here.
     
  11. dawvee

    dawvee

    Joined:
    Nov 12, 2008
    Posts:
    276
    Wow, thanks Gus. I hadn't even thought to try deleting the other armature. I had thought since it had no modifier linked to the mesh objects it wouldn't have affected them at all, but I guess it's some glitch with the fbx exporter?

    The second armature was just there so I could group vertices in a way that I could access those groups easily in Unity (since groups don't import) to transform those vertices. The design has changed enough that I could safely delete that armature without losing anything, though. Thanks again for the help! I'd just had that armature there from the beginning so it never would have occurred to me that it had caused the problem.
     
  12. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    Gus, you should be getting paid for this :D
     
  13. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Glad to hear it works, Dawvee, n.p.
    Mmm, that´s a good idea, Alec ;)
     
  14. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    Could you take a look at this?
     

    Attached Files:

  15. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Sure, but which is the problem here?
     
  16. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    well it's the smae problem really, I had a "bobing" animation but when I saved it, whichever animation was on the "top" was played for every animation I called eg.

    Animation.Play("reload") - If I saved the file on the walk animation, Then that command would instead play the walk animation instead of playing reload.

    its bizarre
     
  17. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    The file I got from your link has only 2 animations (Action and Idle) and works fine here...
     
  18. JamesE

    JamesE

    Joined:
    Jan 23, 2009
    Posts:
    3
    I noticed that having any extra actions or pose library attached to the blend files causes the unity import to mess up. The animations will get split on import according to the names but it looks like they are being duplicated a lot as well and not retaining their animation keys. I don't like keeping animation altogether on one timeline (too old school and painful to edit) so I was hoping I could actually use the stored actions so that I could just work in one master file with a nicely organized action library - same way I would work in motion builder or xsi, then just export all of it at once.

    The best thing I found, is to just save out separate animations, and name them appropriately for unity to import properly, and remove any pose or action libraries from the files as I save them. This allows me to continue working with my single master file and action/pose libraries still, and just deal with saving out separate files from there. It's not perfect but it works and is trouble free aside from having to maintain separate animation files. I'd love to see full support for actions in imported blend files though as this is a strength of blender as an animation tool. If it's there already that's awesome, I'm just not able to do it properly. I'm new to blender and unity but have experience with other game engines and commercial animation packages.

    I love using these two programs together so far though.
     
  19. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Blender Actions works perfectly inside Unity, maybe the problem is with poses (I don´t use them). Try just deleting the poses, keeping only Actions.
     
  20. JamesE

    JamesE

    Joined:
    Jan 23, 2009
    Posts:
    3
    Awesome, it works! Removing the pose library did the trick. This will smooth things out nicely - thanks Gustavo!
     
  21. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    again, you should be getting paid :D
     
  22. mattpelham

    mattpelham

    Joined:
    Mar 17, 2009
    Posts:
    1
    Seems like the same problem for me as well. I've deleted all Pose Libraries references and still no results.

    I'm using the Networking demo, trying to overwrite the Lerpz Third Person Player with this skeleton mesh.

    The model consists of 3 Meshes and 1 Armature. 3 Materials are attached. The Model imports fine, Walks from the get go and I think I remember seeing his Idle animation once early on when testing the model. However, now only the Walk animation will play when debugging, even if I change the Animation element, (unless I set it to None, which led me to believe it was a problem with the model). I'm not exporting an FBX out of Blender, but rather loading the Asset as a .blend directly.

    Any advice would be greatly appreciated, I've tried trolling through the forum and particularly this thread for support.
     

    Attached Files:

  23. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Try deleting the action strips on the NLA window, you only need the actions themselves. Unity will identify each action with an animation cicle for your model.
     
  24. Clydeicus

    Clydeicus

    Joined:
    Feb 21, 2010
    Posts:
    5
    Like the OP, I can only get the last action I had open in Blender to play in Unity.

    Unity manages to get the names and lengths of the animations but just uses frames from the one action. I never made any NLA strips, I've only got one armature, and I didn't make a pose library. I also looked around the outliner screen and couldn't find any other weird action associations myself...

    Here's the .blend file that's giving me trouble:
     

    Attached Files:

  25. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    You need to select all objects in Blender (in object mode) and remove them from all groups (menu object>Groups>remove from all groups). Blender (as many high end 3D apps.) has a lot of tools you cannot use if you want to import your models in Unity, as the fbx exporter/format does not support them. Groups is just one of those tools not supported.
     
  26. Clydeicus

    Clydeicus

    Joined:
    Feb 21, 2010
    Posts:
    5
    That did the trick, thanks!
     
  27. Fuzzyl0gic171

    Fuzzyl0gic171

    Joined:
    Feb 8, 2011
    Posts:
    1
    Hi i´ve also got a problem importing my door + frame with animation from Blender to Unity.

    If i play the animation in Unity the door turns itself around the center.
    But it should act like a door with a hinge. In Blender it is acting like it should. :(

    I exported the animation as .fbx and the modell as .blend.

    Thank you
     
  28. chiako

    chiako

    Joined:
    Oct 17, 2012
    Posts:
    5
    How will I remove the poses?
     
  29. ninjapiraatti

    ninjapiraatti

    Joined:
    Jun 6, 2012
    Posts:
    25
    I'm having the exact same problem but removing groups didn't help. What else could be wrong?
     
  30. meestaman

    meestaman

    Joined:
    May 22, 2015
    Posts:
    1
    A response to the first post as I was having problems solving the same issue...
    Couldn't use my actions in the NLA editor either.

    It is very simple. I had a different object highlighted in the outliner window (e.g light) so none of the actions were being applied to the rig (also for NLA editor). Simply click on your rig in the outliner window and all fixed! Hope this helps another noob (like me) in the future.
    most-recent-action-played-blender-problem-solution-02.jpg

    Edit: Selecting 'hankbones' fixed the problem, not the mesh
     
    Last edited: May 22, 2015
  31. Wolfgame

    Wolfgame

    Joined:
    Feb 7, 2014
    Posts:
    18
    This is still an issue. We've run into it in our project.
     
  32. SteamCyborg

    SteamCyborg

    Joined:
    Nov 24, 2019
    Posts:
    1
    2020, trying to find a solution as I've just started with Blender and Unity3D

    EDIT:
    I found that re-exporting the file worked
     
    Last edited: Feb 22, 2020
  33. Reifus_Strip

    Reifus_Strip

    Joined:
    Apr 10, 2020
    Posts:
    10
    I am going back to maya if blender and unity do not solve this issue with posing library, libray pose is a powerfull for making fast animation, however I break my proyect, when ever I export to unity my 3d model, I Need a defualt t-pose...not a pose library... I can not deleate the library pose... I mean I can , but I use it!! also need to export and export the actions, the NLa action or baked actions, what ever, the animations works, but I hate to start every project in unity and this happens.