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.
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.
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!
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.
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.
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.
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.
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.
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.
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.