Search Unity

(Case 1176699) 2018.4: CinemachineBrain.LateUpdate very expensive

Discussion in 'Cinemachine' started by Peter77, Aug 15, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Using a very simple Cinemachine camera setup is quite expensive for what it is. The project attached to Case 1176699 shows more than 1ms is being spent in "CinemachineBrain.LateUpdate" on an Android Samsung Galaxy S6. Please note that the S6 is actually a quite powerful device.

    The Cinemachine setup is using just two Virtual Cameras:
    • Cinemachine Free Look
    • Cinemachine Virtual Camera

    In our actual game, CinemachineBrain.LateUpdate spikes to more than 2ms with this simple configuration!

    Reproduce
    • Open attached project
    • Build for Android and run on an Samsung Galaxy S6
    • Connect Unity Profiler
    profiler_android.png

    Actual
    Observe CinemachineBrain.LateUpdate costs a lot of performance. According to my profiling, it costs 1.2ms in the provided test project.

    Expected
    Using such a simple camera setup, with two virtual cams only, should cost almost no performance at all.
     
    Fishing_Cactus likes this.
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Our guy who normally answers these is on vacation, but he kindly offered me the following feedback...
    This comes up sometimes. Because they are not doing a deep profile, other stuff gets filed by the profiler under CMBrain.LateUpdate, but it's in fact incorrect. See what happens under deep profile.

    Could you confirm his response for your case?
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Hi Marc, thanks for your quick reply.

    I'm able to reproduce this issue in a new project with just Cinemachine added to it, which is attached to the bug-report. Thus I doubt the performance issue is caused by user code, as the test project does not contain user code. The Cinemachine Component settings are also pretty much just the default settings.

    I just deep profiled the submitted project, but it looks all like Cinemachine to me:
    upload_2019-8-16_8-29-37.png

    Please note that I deep profiled the project inside the editor, as I was unable to deep profile the android player.
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618