Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question Freeze in SendOnPlayableDirectorPlay()

Discussion in 'Timeline' started by Adrien_Danglard, Aug 18, 2020.

  1. Adrien_Danglard


    Nov 4, 2019
    Hello. Sometimes we get a seconds - sometimes almost or over a minute - long freeze when calling
    Code (CSharp):
    1. PlayableDirector.Play();
    - according to the profiler, the culprit is a method called
    Code (CSharp):
    1. PlayableDirector.SendOnPlayableDirectorPlay()
    . This call seems to be spamming calls to GC.Alloc (e.g. we have 24582 calls to GC.Alloc, allocating a total of 0.8 MB; SendOnPlayableDirectorPlay() taking up 24628 ms.)

    Any ideas as to what we might be doing wrong here / how we should be doing things instead?
  2. seant_unity


    Unity Technologies

    Aug 25, 2015
    A couple thoughts

    1) The Play() is actually the culprit - in particular the instantiation of the instance of the timeline. Timeline does allocation - creating script playables along with some internal housekeeping for the timeline playable are the main culprits of allocations although ControlTracks that use prefabs and other custom tracks can always increase those allocations substantially. One way to test this is to use PlayableDirector.RebuildGraph() to create the instance prior to playing it. If the cost moves to RebuildGraph, then creating the instance is where the allocations are occurring.

    2) Something is listening to PlayableDirector.played events and is causing the allocation.