Search Unity

Create arbitrary timeline animation from code

Discussion in 'Timeline' started by mutafikah, Jul 22, 2018.

  1. mutafikah

    mutafikah

    Joined:
    Jul 3, 2018
    Posts:
    5
    I'm trying to create timeline animations via code. The animations will be very simple- just moving the camera from point A to point B, for example. I want to be able to enter the transform of the two positions, and the timeline animation will be created and play. Is this possible? In particular, how do I go about adding key frames to an animation via code, and bind that animation to my game object & timeline? Suggestions or initial direction on this are much appreciated!
     
  2. mutafikah

    mutafikah

    Joined:
    Jul 3, 2018
    Posts:
    5
  3. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    As mentioned in the linked posts, timeline uses animation clips to do any animation. The caveat here is creating animation clips isn't available in the player. So either you'll need to save the animation clips you create, or create a custom track that does the animation without clips (e.g. from AnimationCurve).