Update order problems

Hi. There is a problem of frame delay in my custom playable.

I created new type of track/clip that does dynamic parenting/constraint - you can specify parent and transform offset in clip and then object assigned to the track gets transformed as if parented to the parent object. You can blend between clips to change parenting - super useful when attaching objects to character hands and allow dropping or giving things to other characters etc.

The problem is when using animated characters - my virtual child object transformation is always delayed by what looks like a frame. It looks like my custom mixer gets calculated before skeletal objects get their new transformation values.
Solution would probably be to have some sort of update priority system or late update. Any ideas how to solve this issue?

Edit → Project Settings → Script Execution Order.

If that is not enough look into LateUpdate, or if everything fails call the animator yourself (or better, call your playable Evaluate() or something in LateUpdate())

Tried Script Execution order - added my Track and Clip classes there (they were the only two showing up in the list), but no luck.

Only thing that worked was calling playableDirector.Evaluate from LateUpdate. Only thing that worries me is that it means timeline gets calculated twice, which is not very optimal. I could not find a way to access my custom playable behaviour directly to update it.

When calling it from later update works, that means script execution order must work as well.
Make sure you add the director to the seo list, not your clip, the director is what executes the timeline.

I’m not sure if that would work, as my skeletal animations also get updated from the same timeline. In my case it works because everything is updated twice. I guess there is some sort of internal update that happens before late update that calculates final transforms for skeletal animation or something.
Also I could not find PlayableDirector in the list of Script Execution Order window.

Please tell me how you did this. Parenting/unparenting simply doesn’t work for me (wind up with things out of position at some point, no matter what fix I try,) but I haven’t found another way to get the movement of two objects to stay in-sync reliably.