Search Unity

CPU spike on playing timeline

Discussion in 'Timeline' started by mrtenda, Sep 12, 2019.

  1. mrtenda

    mrtenda

    Joined:
    Jun 6, 2017
    Posts:
    73
    I'm often seeing CPU spikes happen when a timeline starts to play. I've attached a screenshot below. In the case of the screenshot, the timeline only has 8 tracks, so I wouldn't normally expect to see such a spike.

    Is there any way to mitigate this? I am using Unity 2019.2.5f1.

    upload_2019-9-12_19-53-22.png
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi,

    could you please log a bug with this project? this is unexpected.
     
    mrtenda likes this.
  3. mrtenda

    mrtenda

    Joined:
    Jun 6, 2017
    Posts:
    73
    I submitted a bug report (case 1184426).

    Also, I don't know why, but the profiler window's hierarchy data changed when I separated the timeline out into a separate project for the bug report. The spike still happens though. Here's a screenshot of what the profiler shows now (which I also attached to the bug report):

    unity_timeline_cpu.png
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    That profile makes more sense - those are known spikes when playing a timeline. The timeline 'compiles' playable graphs, including animation playables, then plays them, and most of that comes from the compilation phase.

    The workaround in that case is call playableDirector.RebuildGraph() at an appropriate point (scene load, pause, etc..). That will compile the graph, but not start playing it.