Animating GameObjects In Unity Timeline
Other than using normal animation clips from the project files, you can also animate GameObjects using only the Timeline for a single Timeline instance.
Today’s Objective: Animate a GameObject from a Timeline rather than the Animation panel.
Step 1:
Open the Timeline panel. Create or select a GameObject you want to be the base object for your timeline/cutscene. Click “Create” and save the new .playable file in your project files.
Step 2:
Drag the GameObject you want to animate into the Timeline’s left side. Select “Animation Track” as the track type. This will add an Animator component to the animated GameObject automatically.
Alternatively, add it by clicking the + sign, choosing “Animation Track”, and dragging it on.
Step 3:
Now you can animate the object!
On the Timeline, click the red circle to begin recording animation data (Just like using Unity’s Animation panel). Then select the object-to-animate in order to begin making changes. The Timeline panel should remain visible since it is in the animating state.
Now you can make any changes to the object that you wish to be animated. Remember to move the time indicator (the draggable white line on the timeline) after changing something, otherwise everything will only happen on the first frame.
In the above example I’ve just changed the position, but like when you use the Animator panel, you can make any changes to the object and they will be animated using timeline key-frames.
You can also drag an existing animation file into the Animation Track to use that instead: