Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Feedback (Case 1185856) "Enter Play Mode Options", "No Scene Reload" feedback

Discussion in '2019.3 Beta' started by Peter77, Sep 21, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    In Unity 2019.3, you added:
    "Domain reload and/or scene reload can be disabled when entering play mode to allow faster iteration times in the editor"
    https://forum.unity.com/threads/preview-of-2019-3-features.678820/#post-4691099

    I used Unity 2019.3.0b3 to run a few tests that measure the time the editor requires to enter and leave playmode.


    What is the test doing?
    1. It uses the EditorApplication.playModeStateChanged callback to start and stop measuring the time the editor takes to enter and leave playmode.
    2. The test is repeated with different scenes, each containing a different number of either game objects or prefab instances (10.000, 20.000, 30.000, 40.000, 50.000).
    3. The test is repeated with and without the "Enter Play Mode Options (Experimental)" setting.

    Observation
    1. The test shows that turning off Domain- and Scene-Reload affects the time the editor takes to enter playmode in a beneficial manner.
    2. If the scene contains more game objects than "a tutorial type of scene", turning off scene reload still does not make iteration times enjoyable.
    3. While "enter playmode" time improved, "leave playmode mode" did not and affects a big part of the "play stop iteration cycle".

    Please see the attached images.

    enter_playmode.png

    leave_playmode.png

    enter_playmode_prefabs.png

    leave_playmode_prefabs.png

    Reproduce
    1. Open attached project
    2. Open Project Settings, select "Editor" and enable "Enter Play Mode Options (Experimental)" setting. Keep "Reload Domain" and "Reload Scene" unticked.
    3. Open Scene "Transform_10000"
    4. Press Play
    5. Notice in the Console window "Enter Playmode took 1.05 secs"
    6. Press Stop
    7. Notice in the Console window "Leave Playmode took 0.93 secs"
    8. Repeat this multiple times for the scene and take a sample that makes most sense.
    9. Repeat this for scenes Transform_20000, Transform_30000, Transform_40000, Transform_50000
    10. Disable "Enter Play Mode Options (Experimental)" setting
    11. Repeat this test with disabled "Enter Play Mode Options (Experimental)" setting from step 3.
    12. Repeat all of this with the prefab scenes, eg Transform_Prefab_10000 etc

    Actual
    Enter and leave playmode time highly depends on the number of game objects in the scene.
    Having several 10 thousands of gameobjects takes up several minutes to play/stop the editor.

    Expected
    I expected if I turn off "Scene Reload" and press Play, Unity enters playmode in a few seconds (eg 3 secs), regardless of how many gameobjects are located the scene. I also expected that leaving playmode would be instant.

    Note
    Please reproduce this on hardware similar to the hardware I used to submit this bug-report with. Numbers are probably very different if you reproduce this on high-end hardware.

    Please note that the test is rather generous, because all those game objects do not contain any Component than a Transform.

    PS: I did a similar test for Unity 5.6 in the year 2016:
    https://forum.unity.com/threads/5-6...e-of-open-savescene-and-enterplaymode.447500/

    Download
    For anyone interested in the test project:
    http://www.console-dev.de/bin/unity_case_1185856_no_scene_reload.zip
     
    Last edited: Sep 22, 2019
    Arkade, SugoiDev and Ryiah like this.
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Here are profiler screenshots...

    upload_2019-9-21_17-2-38.png

    upload_2019-9-21_17-3-24.png
     
    alexeyzakharov, SugoiDev and Ryiah like this.
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    So leaving play mode makes at least a bit of sense - everything in the current scene needs to be dumped, and the scene must be reloaded from disk.

    Entering play mode saves the scene to a backup disk in order to be able to preserve non-saved changes - so you can move a gameobject and enter play mode with that gameobject moved without having to first save to file. That shouldn't have to happen if the scene isn't dirty though. Can you confirm that the scene's not got any unsaved changes when you enter play mode?
     
    alexeyzakharov likes this.
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Scene didn't have unsaved changes when I entered play mode.
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Will anyone look at this issue? QA didn't reply to the bug-report yet.
     
  6. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    I've pinged the team.
     
    Peter77 likes this.
  7. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    508
    Scene backup and exit playmode behavior are not a part of the experimental "skip domainreload" and "scene reset" feature.
    As @Baste said the exit playmode has to restore the complete scene state - we must load the backup or existing scene file in order to restore potentially destroyed content (and added).

    This sounds like a bug - if there are no changes we load directly from the existing scene file.

    SaveScene being slow sounds like an area for improvements :)
     
    Peter77 likes this.
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Today QA replied to the bug-report as well, so I'm going to paste the answer here for completeness:
    The bug-report is now also available at:
    https://issuetracker.unity3d.com/is...ng-play-mode-even-if-the-scene-is-not-dirtied

    I still wished it would be much faster after all, as the number of game objects increases. It feels like a typical case of non-linear loops, that could be simple to fix once identified which one it is.
     
  9. Ziflin

    Ziflin

    Joined:
    Mar 12, 2013
    Posts:
    132
    Wow that's a depressing set of graphs :(. Thanks for testing @Peter77 and reporting the issue.

    Do you happen to know how extra components effect the transition times? It definitely looks like some crazy n^2 stuff is happening during it. It's stuff like this that makes us question using Unity for our projects.
     
  10. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Nope, no idea. I didn't test it. I attached my test project to the first post, so you could test it yourself if you want to know. Please share results afterwards :)