Search Unity

PlayableBehaviour doesn't receive a ProcessFrame call for last frame of the clip

Discussion in 'Timeline' started by jwvanderbeck, Nov 9, 2017.

  1. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    518
    Pretty much what the title says :)

    If I override ProcessFrame in the PlayableBehaviour it appears to get called for every frame EXCEPT the last one.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    883
    Timeline clips are inclusive on the first frame and exclusive on the last frame. By that I mean a clip that starts at 2 seconds and has a duration of 2 seconds will be active up to, but not including, 4 seconds.

    The reasoning behind this is predictability of adjacent clips. If a second clips starts at 4 then we don't want both active when the playhead is exactly at 4.
     
  3. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    518
    How do we handle the last frame of the animation then?

    We have a custom camera component that gets added to the same GameObject as the Unity camera. This custom camera component connects to our back end pipeline and pulls per frame animation data. The component has a currentFrame field which when set pulls that frame's data from the pipeline and updates the GO's transform, the Unity Camera's FOV, as well as other data.

    This all works ok on its own, and now I am trying to hook it up to Timeline. As the clip plays or is scrubbed, I update the currentFrame field on the custom camera. This seems to work well, though I was having problems figuring out the proper frame initially, but your replies to the other post should help with that so thanks!

    Problem is that since ProcessFrame doesn't get called for the last frame, the camera never gets its last frame of animation updated.
     
  4. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,620

    Is this mentioned anywhere in the documentation, and if so can you please link to where?

    If not, please make sure the relevant colleague is notified of the needed amendment ASAP, thank-you! :)