Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Solved] Why entering PlayMode takes so long? (2+ minutes) Profiling entering the play mode.

Discussion in 'Editor & General Support' started by Tymianek, Jun 20, 2021.

  1. Tymianek

    Tymianek

    Joined:
    May 16, 2015
    Posts:
    97
    Hello.
    I need a way to find assets/scripts/packages that slow down starting play mode. The larger the project gets, the slower the play mode entering. Now, I got over 80GB of assets in my project. Starting any scene, even one with very few objects takes a long time and it slows down the development to a crawl.

    How do I find out, which assets slow down entering the Play Mode?
     
    dog_funtom and Lars-Steenhoff like this.
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Unity Profiler could give some insights into what takes time during Enter Play mode - just enable Edit Mode profiling and enter playmode. Then stop recording and inspect the large frame.
    There is also an experimental tool which might help with investigation - https://forum.unity.com/threads/introducing-the-editor-iteration-profiler.908390/

    There could be multiple reasons why play mode regresses over time. Most common reasons are: serialization (opened editor windows which require serialization and large arrays needed to be stored and restored), InitializeOnLoad methods, type initializers. Profiling (+deep profiling) might help with isolating specific reasons.