- Home /
How to Set the Animator for a Timeline Animation Track through script?
Based on how I'm creating my game, I have the character controller and camera in one scene that I additively load into my levels. However, because of this, I cannot add it into any timeline tracks that aren't in the same scene.
Normally when I try to get a reference to my player, I just find the gameobject with the player tag and set it accordingly, however I have no idea what to be setting it to in the case on a Timeline Animation Track.
Any help would be greatly appreciated.
Answer by seant_unity · Jun 26, 2019 at 11:02 AM
playableDirector.SetGenericBinding(animationTrack, animator) is the call that you want.
The playable director manages the link between the track and the scene object, and they can be set across scenes during execution, but like other scene references won't serialize correctly.
Your answer
Follow this Question
Related Questions
How to move track group timeline? 1 Answer
Issues with Playable Director rotation offset 1 Answer
Timeline: play different animations by hitting different triggers with different colliders 2 Answers
Timeline: gameObject animation is played differently 1 Answer
How can I make the animation timeline more intuitive ? 0 Answers