Answered

Workflow for existing prefabs?

Maxim 3 months ago updated by Peter - Soxware Developer 3 months ago 5

Hello,

I am trying to figure out what to do for my quite specific setup. Any help would be greatly appreciated.

I have a prefab that was created programmatically from a mocap. It uses a "legacy" type animation. In Unity this prefab looks like this:

What I want to accomplish is to upgrade it for modern Mecanim/Humanoid.

I managed to extract the animation clip (*.anim) from this prefab, then opened Animation Converter and placed the clip into the upper box. Then I created a new prefab to be my target (let's say I can use Robot Kyle here). If I understand correctly, I also have to provide the "source prefab" to Animation Converter. It doesn't let me do it, though, complaining that only an Animator or an Animation component must be attached to the Prefab.

I tried to create an empty prefab and placing my animation there, but in this case I just obtain an empty animation as a result. What should I do?

Animation Converter Version:
1.02p03
Unity Version:
2018.4.18

Answer

Answer
Answered

Hi,

thank you very much for your support request.

When converting from generic or legacy to humanoid the following requirements need to be full-filled:

  1. You need to provide the model/prefab of the character the animation has been originally generated for.
  2. You need to provide an exact duplication of that model/prefab but configured as humanoid.

That means that you would need to duplicate the prefab and try to see if you can configure it as humanoid (but I think Unity doesn't support changing the configuration of prefabs, it's only supported for models).

The other way that would allow you to convert your animation to humanoid would be to export the animation to *.fbx (using UMotion Pro for example). If you don't own UMotion Pro and only need one animation to be converted, I can do that for you if you want.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Answer
Answered

Hi,

thank you very much for your support request.

When converting from generic or legacy to humanoid the following requirements need to be full-filled:

  1. You need to provide the model/prefab of the character the animation has been originally generated for.
  2. You need to provide an exact duplication of that model/prefab but configured as humanoid.

That means that you would need to duplicate the prefab and try to see if you can configure it as humanoid (but I think Unity doesn't support changing the configuration of prefabs, it's only supported for models).

The other way that would allow you to convert your animation to humanoid would be to export the animation to *.fbx (using UMotion Pro for example). If you don't own UMotion Pro and only need one animation to be converted, I can do that for you if you want.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Thank you for this clarification. 


When I select my original prefab, the tool complaints that "

only an Animator or an Animation component must be attached to the Prefab", that's the problem. So, how what should I do with my original prefab to make it work? Thank you again. 

You need to check your prefab, it must contain only one Animation component (i.e. the legacy animation system). The component is usually in the root game object of your prefab. Remove any other Animation component or Animator component that you find in the prefab (you can do this on a duplicated version of your prefab in order to have a backup).

Oh and I just had an idea how you can configure your prefab as humanoid: Use Unity's FBX exporter (available via the Package Manager) and export your prefab to *.FBX. Then configure that *.FBX to humanoid.

Best regards,
Peter

Well, it looks like my prefab is so broken that I can't even export it to FBX! It just fails :)

I can't relly push you much as it is clearly some problem in the prefab, but if you have chance, please take a look. At least, the current error message provided by Animation Converter is somewhat confusing.

01da.prefab

I've just checked your prefab. The animation converter warning was correct, the prefab has an "Animation" and an "Animator" component attached. You need to make sure that you have one version of your prefab with only the "Animation" component (= the "legacy" version) and another one with only the "Animator" component (= the humanoid version).

Your prefab even comes with a humanoid avatar, but it is not setup correctly (if you try playing a humanoid animation with it, you'll notice that the arms bend in the wrong direction). So you need to export your prefab to FBX and then make sure to generate a correct humanoid avatar. Unfortunately I also wasn't able to export this character to *.FBX as the FBX Exporter always throws a null reference exception. This seems to be a bug in the FBX exporter, you might want to report this issue to Unity (I recommend doing so vie Unity's bug reporter, then post the issue ID in the FBX exporter forum). You can also take a look at the code yourself (it's available in the FBX exporter package).

Best regards,
Peter