Taking Player Input Away From the Player While a Timeline Sequence is Active in Unity — No Code Required!

Chris Hilton
3 min readMar 2, 2022

Objective: To remove the player input while a Timeline sequence is playing in Unity.

Timeline sequence with Idle Animation stopping the players movement during the cutscene

I have just finished up the ‘Combining Cinemachine and Timeline to Open a Treasure Chest in Unityarticle and have noticed that the player still has full control while the sequence is playing. Let’s remove this by adding 1 simple track!

Existing Scene

Player opening a treasure chest and triggering a Timeline sequence

Currently we have the player approaching the treasure chest, triggering a Timeline sequence to play out. However, the issue we have now is that the player still has full control of the character and it takes away from the emphasis of the cutscene itself as it looks a bit stupid. Let’s remove this!

Adding an Animation Track to Timeline

Yes this is as easy as it gets! Let’s just add an animation to the Timeline while the sequence/cutscene is playing out and the player loses all control! I have found an ‘Idleanimation from Mixamo and added this to the Timeline:

Adding an Idle Animation Clip to an Animation Track

Problem!

However, it wouldn’t be game development if we didn’t find more issues as we build out our scene:

As you can see, as the Timeline sequence plays out the character moves to the transform position of the PlayableDirector() component game object.

Lucky for us there is an easy solution!

We are going to use a ‘Clip Transform Offset’ of the Animation Clip.

Solution!

While having the Animation Clip highlighted in the Timeline, head over to the Inspector and look for the ‘Clip Transform Offsetsfeature and click on the arrows symbol. Make sure that the Timeline Playhead (white line in Timeline) is at the right keyframe/seconds that you wish to apply the transform offset to.

Using Clip Transform Offset for the Idle Animation Clip in Timeline

Let’s Test It!

The behaviour we now expect is the player has movement up until they trigger the sequence, with the ‘IdleAnimation Clip taking control of the players movement. Once the sequence is finished, movement should come back to the player:

Timeline sequence with Idle Animation stopping the players movement during the cutscene

Works great! Just needs a bit of blend tweaking =)

--

--