Search Unity

Evaluate() not working as expected

Discussion in 'Timeline' started by gregoired, Jun 27, 2017.

  1. gregoired

    gregoired

    Joined:
    Apr 8, 2013
    Posts:
    20
    Hello there,

    I want to be able to scroll throughout my timeline by setting the time directly and calling Evaluate() instead of Play() in the DirectorPlayable component. When I call Evaluate() with the time update mode set to" game time", it kind of works except that the timeline play automatically right after. If i try to call Pause() right after or using a different time update mode, the time value change and the timeline arrow is scrolling accordingly but the animation stays at 0. What did I miss ?
     
  2. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    56
    Hi gregoired,

    You probably want to set the PlayableDirector's Update Method to Manual. (and uncheck Play On Awake)

    upload_2017-6-27_17-59-59.png

    (Or by script)
    Code (CSharp):
    1. director.timeUpdateMode = DirectorUpdateMode.Manual;
    Then manually update the Time and Evaluate :
    Code (CSharp):
    1. director.time += deltaTime;
    2. director.Evaluate();
    Hope this helps!
     
  3. gregoired

    gregoired

    Joined:
    Apr 8, 2013
    Posts:
    20
    Hi Chafik and thanks for your reply !

    I tried to do what you said using the latest version of Unity beta (2017.1.0f1) but it's still not working for me !
    I attached a simple scene where I was able to reproduce my problem

    Cheers,
    Grégoire
     

    Attached Files:

  4. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    56
    Hi Grégoire.

    The reason the camera is not moving is because an Animator Controller is applied to it and overriding any animation done by the Timeline.

    Make sure to set the Controller to None:

    upload_2017-6-28_9-59-2.png

    Thanks!
     
  5. gregoired

    gregoired

    Joined:
    Apr 8, 2013
    Posts:
    20
    Haa that makes sense !

    Thank you so much
     
    thierry_unity and chafik_unity like this.
  6. fractalInsanity

    fractalInsanity

    Joined:
    Aug 21, 2017
    Posts:
    1
    Definitely should be in a manual. I've spent an hour to figure this out.
     
  7. wang37921

    wang37921

    Joined:
    Aug 1, 2014
    Posts:
    102
    I have reappear the situation. null the Animator's Controller field will fix this problem.
    But, why update method is GameTime dont need the filed is empty?
    If i want stop PlayableDirector then fade out to Animator. how to do it?
    If Manual update works like GameTime update, it's better.
     
  8. zavidiy

    zavidiy

    Joined:
    Jun 5, 2017
    Posts:
    11
    Do you find answer on your quastion?
     
  9. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If the update method is GameTime, the playable director is updated by the engine (after Update()), and the animator will blend in the timeline after the animator controller. With Manual, you are responsible for evaluating the timeline with Evaluate() and running it in Update() means the animator controller will overwrite whatever changes Timeline makes.

    Running it in LateUpdate() will give similar behaviour to GameTime, but the script priority should be set early so any other LateUpdate() scripts run correctly.
     
    tap4fun_cuinc and Xury46 like this.
  10. Masoverflow

    Masoverflow

    Joined:
    Jan 20, 2013
    Posts:
    5
    I'm trying to get a PlayableDirector to work on Manual mode with the RigBuilder component. If I call the PlayableDirector Evaluate in Update the RigBuilder IK works but no animation and if I run it in LateUpdate I get the animation but no IK.
    This is with the updating script running behind in execution order.
    I also tried calling the RigBuilder graph evaluate but no matter the order I can't get both the animation and IK to work together, one always replaces the other.
    All works when set to GameTime but I need to be able to play the timeline in fast forward.
     
  11. Tamago-Jam

    Tamago-Jam

    Joined:
    Mar 16, 2016
    Posts:
    4
    Hi, my problem exactly same as yours, could you please share your solution or some information?