Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Bake TImeline Animation back to Object

Discussion in 'Timeline' started by jeffsarge, Jul 14, 2018.

  1. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    Is there a way to bake timeline information back to the object for FBX export?

    I want to create animation in Unity and then send it back to Maya. I'm working with a lip sync plugin so I would need to capture an animation clip and then bake it back to the object for export.

    Thanks,

    Jeff
     
  2. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    158
    You can use the new FBX Exporter to export the animation directly from Timeline to FBX. In the Timeline window, select the desired animation clip, then from the top menu select GameObject > Export Selected Timeline Clip. This will export the clip into an FBX containing only the animation (which can then be applied to the object in Unity or Maya).

    If you want to export the animation into the same file as the animated object:
    1. create an animator controller and add the animation clip as a state
    2. add the animator controller as the controller on the object to animate's Animator Component
    3. right click on the object and click "Export to FBX"
    4. In the Options make sure that for the "Include" option, "Model(s) + Animation" is selected (or "Animation Only" to only export the animation)

    Hope this helps!
     
  3. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    Thanks. The GameObject > Export Selected Timeline Clip does nothing.
    I've done 3 tests with a simple cube.

    1) Create animation in the Animation Window so that the animation is actually on the Cube. Then right click the cube in the hierarchy and select Export to FBX. The Cube comes into Maya with the animation as I would expect.

    2) Create animation in the Timeline window, then convert to a Clip Track. Highlight the clip and select GameObject > Export Selected Timeline Clip. Nothing happens and nothing is exported.

    3) Repeat step 2 and select GameObject > Export to FBX. Model is exported but no animation.

    Am I missing something?

    Thanks,

    Jeff
     
  4. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    158
    Do you see this window?

     
  5. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    No, that window does not appear. I'm on Unity 2018.2.
    Jeff
     
  6. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    158
    Do you have the latest version of the FBX Exporter? You can find the instructions to install it here.
     
  7. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    that was it. Thanks. Now the dialogue box comes up. This only exports Transforms... correct? It does not appear to work with Blend Shapes.
    Jeff
     
  8. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    158
    In the current version of the FBX Exporter, only Transform, Light, Camera, and Constraint animation are supported.
     
  9. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    Thanks.
    Jeff
     
  10. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    Dont wok both the methods.
    Unity 2018.3.10 and FBX Exporter 2.0.1

    Exporting selected timeline clip: NullReferenceException: Object reference not set to an instance of an object
    Exporting FBX from Object + Animation Controller produces and animation where the model only rotates around itself

    Any update on the method to be followed?
     
    IN_Audrey likes this.
  11. Alejandro-Martinez-Chacin

    Alejandro-Martinez-Chacin

    Joined:
    Oct 15, 2013
    Posts:
    93
    Hi!
    I'm using FBX Exporter 2.0.1-preview-11 and Unity 2019.1.1f1 and can confirm that right clicking on "Export Selected Timeline Clip..." does nothing (nothing on the output console either).
    Where do we right click on? The object that has the timeline playable? The objects themselves animated and referenced by the Timeline Object?
    Or should we just use the Export FBX... one for each of the objects?

    What's the expected output? Is it a single FBX with all the animated models, cameras and all (minus signals and dynamic triggers I guess)?
     
    IN_Audrey likes this.
  12. IN_Audrey

    IN_Audrey

    Joined:
    May 2, 2018
    Posts:
    1
    Hello! I'm having the same error in unity 2018.3.12 when selecting a clip on the timeline and going through the menu bar Gameobject->Export Selected Timeline Clip...

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Formats.Fbx.Exporter.AnimationOnlyExportData.GetPropertyReflection (System.Object obj, System.String propertyName) (at Library/PackageCache/com.unity.formats.fbx@2.0.1-preview.11/Editor/IExportData.cs:134)

    Is there an update on it by any chance?
     
  13. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    222
    Hi @elettrozero , @Alejandro-Martinez-Chacin , @IN_Audrey ,

    The broken timeline export issue has been fixed and will be available in the next release of the FBX exporter.

    The workflow for exporting a clip from the Timeline is as follows:
    1. Select the desired Animation Clip on the Timeline
    2. From the top GameObject menu click "GameObject > Export Selected Timline Clip..."

    upload_2019-5-17_14-11-8.png

    This will bring up the export menu. What is exported is the animation for Transforms, Lights, Cameras, and Constraints. Meshes and any objects not required for the animation will not be exported.

    Alternatively, until the fix is released, another way to export the same animation is to instead add the Animation Clip onto the animated object's Animation or Animator component. Then right click on the animated object and select "Export to FBX...".

    upload_2019-5-17_14-13-34.png

    In the Export Options menu, you can then choose to export either the Model and animation, or only Animation, which will give the same result as exporting directly from the Timeline.

    upload_2019-5-17_14-14-3.png

    Best,
    Viktoria
     
  14. Kyunh

    Kyunh

    Joined:
    Dec 23, 2016
    Posts:
    5
    I have the exact same issue. This is my result:

    Left: Original prefab; Right: Exported FBX of prefab imported/used

    These are the steps I took:
    1. Installed FBX Exporter v2.0.1 in Unity 2019.1.3f1 [Image]
    2. Put animator controller with walk animation from standard assets on animator of the gameobject to export as fbx
    3. Rightclick gameobject -> export to fbx... [Image]
    4. I set the following export options: [Image]
    5. The gameobject was exported but the rotation is strange [Image: Model tab] [Image: Animation tab]
    6. I drag the new (exported) fbx into the scene and repeat 2. with it's embedded walk animation [Image]

    I tested:
    FBX Exporter v2.0.1 in Unity 2019.1.3f1
    FBX Exporter v2.0.1 in Unity 2018.4.0f1
    FBX Exporter v2.0.1 in Unity 2018.3.14f1
    FBX Exporter v1.3.0f1 (Asset Store) in Unity 2018.3.14f1
    Different models and different animations (mostly free assets from the asset store)
    Different export options

    What am I doing wrong?
     
  15. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    222
    Hi @Kyunh,

    Thank you for the detailed steps, I was able to reproduce the issue.

    It looks like the character and animation you used have a humanoid rig. Unfortunately we do not currently support export of humanoid characters or animations. In order to export the animation, the rig and animation will need to be either legacy or generic.

    In some cases, simply changing the character and animation rig from "Humanoid" to "Generic" may be enough. However though not ideal, there is another workaround for exporting humanoid animation using the Unity Recorder. Here are the steps:

    1. Install the Unity Recorder from the Package Manager
    2. Create a Timeline and add an animation track for the humanoid character, along with the desired animation
    3. In the Recorder Window (Window > General > Recorder > Recorder Window), add a new Animation Clip recorder
    4. For the Animation Clip recorder, set the GameObject to the humanoid character in the scene, and make sure that the Transform is selected for the Recorded Targets, and that the Record Hierarchy option is checked.

    upload_2019-5-23_14-50-27.png

    5. Click "Start Recording" in the Recorder window to record the humanoid animation to a new animation clip
    6. Browse to the humanoid character FBX and change its rig type to Generic
    7. Follow the same steps you used to attach the recorded animation to the character and export

    Best,
    Viktoria
     
  16. bobthenob

    bobthenob

    Joined:
    Sep 2, 2013
    Posts:
    22
    hi i tried your above instructions it nearly worked
    the first part of my timeline clip worked but the second clip moved my character but his legs and arms didnt move he just slid along
    or the second time i tried it only recorded the first clip in the timeline
     
  17. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    222
    Hi @bobthenob,

    Would it be possible to please send me a package with your character and the animation you are trying to export that is not working?

    Also, we have recently released a new version of the FBX exporter (version 3.1.0 in package manager), which allows you to record directly to FBX from the Unity Recorder instead of first recording to an animation clip.

    This will simplify the steps to export a little bit. Here are the updated steps with the new package:

    1. Update to FBX exporter 3.1.0 from the Package Manager
    2. Create a Timeline and add an animation track for the character, along with the desired animation
    3. In the Recorder Window (Window > General > Recorder > Recorder Window), add a new FBX recorder
    4. In the FBX recorder, set the GameObject to the character in the scene, and make sure that the Transform is selected for the Recorded Targets, and that the Record Hierarchy option is checked.
    5. (optional) Check that the "Export Geometry" Option in the FBX recorder settings is checked so that the character skinned mesh is also exported to FBX.
    6. Click "Start Recording" in the Recorder window to record the humanoid animation to FBX

    Best,
    Viktoria
     
    dorseykrofft1 likes this.
  18. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    201
    Is it possible to record Humanoid Animators with FBX Exporter and Recorder?

    I'm trying to sequence animations in Timeline and then export those sequences as single animations. Is this possible?

    Thanks,
    Nathan
     
  19. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    222
    Hi Nathan,

    It is possible to record humanoid characters with the recorder, however the animation exports as generic and not humanoid. It may be possible to import it as humanoid by changing the rig import setting on the animation from generic to humanoid, however it is intended to be generic so this may not work in all cases.
    The animation can otherwise be applied to a generic version of the character, or if the "Export Geometry" option is checked in step 5, can be applied directly to the exported character.

    The steps to record are:
    1. Install the FBX exporter and Unity Recorder from the Package Manager
    2. In your Timeline add an animation track for the character, along with the desired animation
    3. Add an FBX Recorder from the Recorder Window (Window > General > Recorder > Recorder Window). Alternatively add a Recorder track to the Timeline and set it to record FBX.
    4. In the FBX recorder, set the GameObject to record as the character in the scene. Make sure that the Transform is selected for the Recorded Targets, and that the Record Hierarchy option is checked.
    5. (optional) Check the "Export Geometry" Option in the FBX recorder settings so that the character's skinned mesh is also exported to FBX.
    6. Click "Start Recording" in the Recorder window to record the animation to FBX. Or enter Playmode if using a Recorder track.

    You can choose which part of the animation to record by either changing the Recording Mode in the Recorder Window, or the start/end time of the Recorder track.

    For additional information please see the documentation.

    Best,
    Viktoria
     
    nathanjams likes this.
unityunity