Search Unity

Resolved Long time to Enter Playmode

Discussion in 'Entity Component System' started by vectorized-runner, Jun 25, 2020.

  1. vectorized-runner

    vectorized-runner

    Joined:
    Jan 22, 2018
    Posts:
    398
    It takes 10-15 seconds to enter playmode in project with Entities, Hybrid Renderer and HDRP. I don't know if there is a fix.


    Screenshot_1.png
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    vectorized-runner likes this.
  3. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Worth noting that you need to write your code very carefully to avoid problems related to this. Any static global is suspect, as can be any [ExecuteInEditMode]/[ExecuteAlways] MonoBehaviours or Systems.
     
    vectorized-runner likes this.
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    When writing idiomatic ECS code there really aren't problems... All worlds get recreated on enter playmode... And idiomatic ECS code doesn't use static variables.
     
  5. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    Fast enter playmode is great when you can use it. However, time to enter playmode from a script change has increased quite a bit since 2019.3.

    I can't find the thread now but most people were reporting 30-40% increase in time.

    EDIT: here's the thread:
    https://forum.unity.com/threads/cas...ty-project-takes-significantly-longer.691996/

    Some people including myself got the old enter playmode from script change times back by switching back to asset database v1.

    I then had to go back to v2 anyway because the latest DOTs requires it :)
     
  6. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Fair enough for a GameJam scenario, or a very dedicated team working from scratch. However, that means you need to throw out a bunch of legacy code, avoid asset store (and some Unity builtins!), and put additional engineering effort towards ECS-ifying everything (which isn't a good fit for every problem domain, especially in its current state, and has no good UI framework).

    And even if you're writing "idiomatic ECS," it's easy for some kind of static state to sneak in (chances increase as number of developers increases). This isn't true of just game development; it's the case across the board, but is especially hard when writing high-performance code where the enterprisey ways to avoid this (isolation of state, DI/IoC, microservices) and functional ways (tons of immutable throwaway objects) are undesirable.