Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Configurable Enter Play Mode

Discussion in '2019.3 Beta' started by alexeyzakharov, Oct 29, 2019.

  1. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    612
    I'm afraid it will fail in some scenrios.

    It is often needed that a singleton instance does not exist in the scene before we enter play mode, and is created only if (and when) it is called. It's lazy instanciation.

    It is also often needed for a game object to use a singleton during its destruction, for example to unregister itself from it (listener pattern), or write a destruction log.

    In these conditions, on application quit, such a game object may cause the re-instanciation of the singleton after its OnDestroy, depending on the order of destruction (which must remain unpredictable).

    I've ended up using the RuntimeInitializeOnLoadMethod attribute in all the concrete implementations that may suffer from this issue, but I feel like it's not ideal.

    Anyway, thank you @alexeyzakharov for your time and efforts.
     
    Last edited: Mar 16, 2020
    alexeyzakharov likes this.
  2. bvance

    bvance

    Joined:
    Oct 25, 2012
    Posts:
    13
    I'm noticing an interesting behaviour during which a particular static variable in ECS (0.8.0-preview.8) is storing one BaseSystem lamba from the previous playmode entry, and then re-running it at some point during a subsequent playmode as the ECS wakes up.

    In Rider's debugger it appears to me as this method being invoked 'out of nowhere' (it's the top of the callstack):
    Code (CSharp):
    1. public static void Execute(ref JobChunkWrapper<T> jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref JobRanges ranges, int jobIndex)
    2.             {
    3.                 ExecuteInternal(ref jobWrapper, ref ranges, jobIndex);
    4.             }
    I'm thinking however that it probably relates to the statics written above that:
    Code (CSharp):
    1.             static IntPtr s_JobReflectionDataParallel;
    2.             static IntPtr s_JobReflectionDataSingle;
    3.  
    4.             public static IntPtr InitializeSingle()
    5.             {
    6.                 if (s_JobReflectionDataSingle == IntPtr.Zero)
    7.                     s_JobReflectionDataSingle = JobsUtility.CreateJobReflectionData(typeof(JobChunkWrapper<T>),
    8.                         typeof(T), JobType.Single, (ExecuteJobFunction) Execute);
    9.  
    10.                 return s_JobReflectionDataSingle;
    11.             }
    12.        
    13.             public static IntPtr InitializeParallel()
    14.             {
    15.                 if (s_JobReflectionDataParallel == IntPtr.Zero)
    16.                     s_JobReflectionDataParallel = JobsUtility.CreateJobReflectionData(typeof(JobChunkWrapper<T>),
    17.                         typeof(T), JobType.ParallelFor, (ExecuteJobFunction) Execute);
    18.  
    19.                 return s_JobReflectionDataParallel;
    20.             }
    It actually succeeds at running the lambda, but promptly throws me a 'HashMap is full' exception (I'm not really certain what state it's iterating over at this point, lol. The new ECS data? The last run's ECS data!?).

    FYI: The lambda's pretty simple, it's the JobComponentSystem kind and populates a hashmap like so:

    Code (CSharp):
    1.             var allGenericsWriter = allGenericContextReferences.AsParallelWriter();
    2.             var gatherReferencedUsageCategories = Entities.ForEach((DynamicBuffer<MoveGenericContextReferenceBuffered> buffer) =>
    3.             {
    4.                 for (var index = 0; index < buffer.Length; index++)
    5.                 {
    6.                     var b = buffer[index];
    7.                     allGenericsWriter.TryAdd(b, true);
    8.                 }
    9.             }).Schedule(inputDeps);
     
  3. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    968
    Last edited: Apr 26, 2020
  4. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    489
    FeastSC2 likes this.
  5. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    968
    @alexeyzakharov Thanks and great job on this feature! It's fantastic ;D
    It's much more pleasurable to work on creating games with Unity now :)
     
    alexeyzakharov likes this.
  6. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    31
    @alexeyzakharov I am upgrading to 2019.3 (and LTS ASAP), writing all new code for refactoring an existing project with new architecture and infrastructure, and I am looking at this experimental feature. I want to write my code to be in line with this methodology if possible. I have some feedback and questions based solely on what I have read in this thread. I have not begun to experiment with Configurable Enter Playmode yet.

    The follow questions occured to me after reading your description of how scene reloading works normally, versus avoiding a scene reload:

    Do runtime scripts only have Awake() called once per editor session? Could this be reset to get called each time Play is pressed? I am not too worried about whether Awake() is called each play session personally. I tend to avoid it as a method also because it does not get called on components of inactive GameObjects in the scene, which can be quite confusing to some people. I prefer OnEnable() / OnDisable() as well as Start() and Destroy() when necessary. However, if people are using the Awake() method, I assume they would want their editor experience to mimic what would happen in their build, which is that Awake() would be called.

    "Basic assumptions is that the editmode state is equivalent to what you get from backup (except of private/NonSerializedFields!)."

    This seems like a big problem. In my humble opinion, private, non-serialized, and static (if possible) fields should be reset to their defaults. This is because developers want to see what would happen in their build if they enter play mode. In their build, these values would be set to expected values. I rely on these types of assumptions all the time when programming. And, why not? That is how it will work in the final build. There is nothing wrong with writing code assuming the default values of non-serialized fields if you understand clearly what those will be. Expecting the programmers to warp their behavior around this, and to break backwards compatibility is asking too much. I believe that resolving this on the Unity side would go a long way to bring this feature out of experimental status. If I understand correctly, the expensive part is reading and deserializing the temporary copy of the scene(s). Well, would iterating the scene(s) and resetting all appropriate values be cheaper? Would it be done through reflection? Is this too expensive? I don't know, but I do think it will be hard to develop around not knowing what may end up in your non-serialized fields. I think in the end most serious developers would develop their own solution to manually reset all of these, adding more development time and headaches, and taking just as long to hit play and "load" as if Unity handled it for us.

    Not calling OnDestroy() when entering playmode seems fine. Was it even being called when entering play mode for non-editor executing scripts, anyway?

    3rd party assets. This is a problem with the Asset Store in general. It's difficult to determine whether a particular asset conforms to, for instance, your chosen Color Space setting, ECS, Configurable Enter Play Mode, etc. unless it is explicitly called out in the description by the creator. Will we ever see the Asset Store gain something like compliance tags, even for new and experimental features such as this?
     
    alexeyzakharov and laessnb like this.
  7. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    31
    After reading back through the thread, particularly looking back at the diagram I answered some of my own questions in the previous post and came up with a little more feedback:

    Some answers to my own questions:
    - Awake() is indeed called every time you press play, but not for editor scripts.
    - OnDestroy() was only being called for editor scripts.

    It seems like configurable play mode is a big win conceptually for editor scripts, as they are receiving extra, redundant OnEnable() and OnDisable() calls when pressing play normally. It seems the editor components get rid of a lot of unfitting or redundant lifecycle methods by quickly entering play mode. It fits more conceptually with how something that's always running should be expected to work, and which methods should be called when. The methods align more with the editor and not entering play mode, which is what I would expect from editor scripts. Developers could see some differences between playing in editor, and on build, but the fault there would likely lie with the developer and how they are using that component that they chose to allow to run in the editor as well.

    What I mentioned in the previous post about Unity needing to set default values for non-serialized fields was intended for game scripts only. Also, it only seems a problem when both domain reload, and scene reload are disable, as otherwise one of them would reset the non-serialized valued. So, perhaps only if BOTH are disabled, then an alternative way of resetting non-serialized game script fields to their default expected values should be applied. I wasn't really thinking much about editor scripts or multithreaded ECS DOTS jobs, etc. Editor scripts should maintain non-serialized field values through editor play sessions. (I think. I don't use a lot of ExecuteInEditMode scripts.) Most devs are going to be thinking about game scripts most of the time, so I think at least getting those to reset their non-serialized values on entering play mode, however you have to do it, the fastest way you can come up with, is still vital.

    In the diagram, when both domain reload and scene reload are disabled, what is calling OnDisable() for editor scripts before OnEnable() is called when entering play mode? It seems like it is called, according to testing by @Peter77 I don't see it in the diagram.

    The diagram could use a section for Exiting Play Mode, not just entering. That would make it clear where the matching Game script OnDisable() call is coming from.

    Question: Does a domain reload occur automatically when AssetDatabase.Refresh() is called? If I have it set to only reload assets on Ctrl-R, and I trigger a refresh, will the newly imported scripts trigger a domain reload? I would hope so, that's what I would want to happen.

    Before we get too far down a rabbit hole with singletons and static instances I wanted to point out to @methusalah999 and anyone else that relies heavily on singletons (including past versions of myself!) that this is exactly, explicitly one of the reasons that people decry singletons. I am currently in the process of trying to reduce the number of singletons I use and consolidate them more into a composition root that can run non-monobehaviour classes and implment inversion of control (IOC) by injecting the dependencies (DI) into the interface properties that a class normally depending on some other singleton would reach out for. So, this is in some sense more an argument over the architecture of the code moreso than whether this feature "breaks singletons," especially a very particular implementation of "singletons." I'm not trying to throw shade for using singletons. Sometimes they come right along with 3rd party plugins. I've used them heavily for years. But, there are other ways, better ways.... Oh, and yes I plan to use RunTimeInitializeOnLoad for my composition root and dependency injection SINGLETON :eek: just as you mentioned as a way to fix the problem methusalah. A composition root with a container for dependency injection can solve the problem of lazy instantiation raised here (and many others!)
     
    Last edited: May 6, 2020
    alexeyzakharov and laessnb like this.
  8. mattnewport

    mattnewport

    Joined:
    Jan 29, 2016
    Posts:
    15
    I agree with the previous comment that it's not ideal that this is a project setting. I'd prefer it to be a local / per user setting. What would work best for our project though is to have an overload of
    EditorApplication.EnterPlaymode()
    that lets you specify the options. We already have a custom editor panel for our artists and designers to help them launch a scene with the right options for the particular scenario they're working in and we could put a 'fast play' button there which would call
    EnterPlayMode()
    with the fastest options that we know work for our projects and let them know to use the regular play button if they have problems.
     
  9. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    31
    I realized I need to clarify my request to say that non-serialized fields of game scripts should be set to EITHER the default value for that type, OR the specified value in the declaration.

    If this cannot be accomplished on the Unity side I think it should be the number one thing that is called out very clearly and explicitly in the documentation, maybe in large red letters:

    If you have domain reload AND scene reload disabled, YOU MUST MANUALLY INITIALIZE NON-SERIALIZED (PRIVATE) AND STATIC FIELDS, like during OnEnable(). Otherwise, reading from the variable will lead to inconsistent, unpredictable behavior. Static fields can be initialized using a static method decorated with the [RunTimeInitializeOnLoad] attribute.

    The [RunTimeInitializeOnLoad] attribute cannot be used in generic classes. This breaks everyone's generic Singleton class. :confused: It also breaks my generic static object pools that I could call from anywhere to get pooled List<T> objects for super fast list modification. However, that may be for the best. Such classes are perhaps a bit too magical for their own good. With a little more code we can still accomplish the same result.

    Static access to generic classes can still be accomplished by creating a concrete static factory or service locator class with a generic method that returns appropriate instances. The concrete static factory maintains a private(!) dictionary that maps System.Type to the appropriate System.Object, collection of objects, or factory. This is in line with Alexey's recommended best practices, "Prefer singletons which are initialized with Awake/RuntimeInitializeOnLoad to having a many scattered static variables."

    This seems like a lot to ask of developers. There is a LOT of code floating around that does not comply to these standards.

    The one thing I don't understand is why the non-serialized and static fields are not set to default or declared values when the scene is reloaded upon exiting playmode, as pointed out here? I assume it is because ctor is being called and serialized fields are being deserialized, but non-serialized fields are being skipped over. When the scene reloads upon entering playmode, non-serialized values are set correctly, no? Couldn't the same thing be moved to occur when exiting playmode? Wouldn't this solve a lot of issues?
     
  10. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    556
    Hi @alexeyzakharov

    Unity 2019.3.12f1 is crashing on me . I tried disabling and enabling Domain\ Scene but still crashes.

    I pasted the Crash log here , I can't understand it very well. But perhaps you can see what's causing the instability?

    I PM'ed you the crash dump too.


    Thanks for the help!

    Code (CSharp):
    1. [   2720 MB ]Entering Playmode with Reload Domain disabled.
    2. If you experience any issues, please disable "Enter Play Mode Options (Experimental)" in Editor SettingsEntering Playmode with Reload Scene disabled. If you experience any issues, please disable "Enter Play Mode Options (Experimental)" in Editor Settings
    3. Assertion failed on expression: 'm_InstanceID != InstanceID_None'
    4. Crash!!!
    Code (CSharp):
    1.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Refresh completed in 0.396931 seconds.
    2. RefreshInfo: RefreshV2(ForceSynchronousImport)
    3. RefreshProfiler: Total: 396.782ms
    4.     InvokeBeforeRefreshCallbacks: 0.584ms
    5.     ApplyChangesToAssetFolders: 0.079ms
    6.     WriteModifiedImportersToTextMetaFiles: 0.000ms
    7.     CleanLegacyArtifacts: 0.000ms
    8.     Scan: 341.225ms
    9.     OnSourceAssetsModified: 0.000ms
    10.     UnregisterDeletedAssets: 0.000ms
    11.     InitializeImportedAssetsSnapshot: 29.272ms
    12.     GetAllGuidsForCategorization: 0.000ms
    13.     CategorizeAssets: 0.000ms
    14.     ImportAndPostprocessOutOfDateAssets: 0.000ms (0.001ms without children)
    15.         ImportManagerImport: 0.000ms (0.000ms without children)
    16.             ImportInProcess: 0.000ms
    17.             ImportOutOfProcess: 0.000ms
    18.             UpdateCategorizedAssets: 0.000ms
    19.             RemoteAssetCacheGetArtifact: 0.000ms (0.000ms without children)
    20.                 RemoteAssetCacheResolve: 0.000ms
    21.                 RemoteAssetCacheDownloadFile: 0.000ms
    22.         CompileScripts: 0.000ms
    23.         PostProcessAllAssets: 0.000ms
    24.         ReloadImportedAssets: 0.000ms
    25.         VerifyAssetsAreUpToDateAndCorrect: 0.000ms
    26.         EnsureUptoDateAssetsAreRegisteredWithGuidPM: 0.000ms
    27.         InitializingProgressBar: 0.000ms
    28.         PostProcessAllAssetNotificationsAddChangedAssets: 0.000ms
    29.         OnDemandSchedulerStart: 0.000ms
    30.         RestoreLoadedAssetsState: 0.000ms
    31.     InvokeProjectHasChanged: 0.000ms
    32.     UpdateImportedAssetsSnapshot: -0.001ms
    33.     ReloadSourceAssets: 0.000ms
    34.     UnloadImportedAssets: 0.000ms
    35.     Hotreload: 0.875ms
    36.     FixTempGuids: 0.007ms
    37.     VerifyGuidPMRegistrations: 0.000ms
    38.     GatherAllCurrentPrimaryArtifactRevisions: 2.563ms
    39.     UnloadStreamsBegin: 0.130ms
    40.     LoadedImportedAssetsSnapshotReleaseGCHandles: 2.619ms
    41.     GetLoadedSourceAssetsSnapshot: 13.664ms
    42.     PersistCurrentRevisions: 0.000ms
    43.     UnloadStreamsEnd: 0.062ms
    44.     Untracked: 5.704ms
    45. <RI> Initialized touch support.
    46.  
    47. - Collect Sprites to Pack : (SequentialAtlasing : 0)
    48. [   2609 MB ]- Grouping sprites using the selected SpritePackerPolicy.
    49. [   2720 MB ]-     Atlas "RewiredControlMapper" with 6 sprites assigned.
    50. [   2720 MB ]- Completed grouping sprites to Atlas.
    51. [   2720 MB ]- Build Sprite Atlas.
    52. [   2720 MB ]- Packing 1 atlases.
    53. [   2720 MB ]- Atlas (RewiredControlMapper) file (bc9196babc0f9b45daaa4194f0968b29) found. Mapping.
    54. [   2720 MB ]- Packing completed.
    55. [   2720 MB ]- Update Sprites and Cleanup.
    56. [   2720 MB ]Entering Playmode with Reload Domain disabled.
    57. If you experience any issues, please disable "Enter Play Mode Options (Experimental)" in Editor SettingsEntering Playmode with Reload Scene disabled. If you experience any issues, please disable "Enter Play Mode Options (Experimental)" in Editor Settings
    58. Assertion failed on expression: 'm_InstanceID != InstanceID_None'
    59. Crash!!!
    60. SymInit: Symbol-SearchPath: 'C:/Program Files/Unity/2019.3.12f1/Editor/Data/Mono;.;C:\ProjectY;C:\Program Files\Unity\2019.3.12f1\Editor;C:\Windows;C:\Windows\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'PC'
    61. OS-Version: 6.1.0
    62. C:\Program Files\Unity\2019.3.12f1\Editor\Unity.exe:Unity.exe (000000013FCC0000), size: 136200192 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2019.3.12.45623
    63. C:\Windows\SYSTEM32\ntdll.dll:ntdll.dll (0000000077060000), size: 1699840 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    64. C:\Windows\system32\kernel32.dll:kernel32.dll (0000000076F40000), size: 1175552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    65. C:\Windows\system32\KERNELBASE.dll:KERNELBASE.dll (000007FEFCBF0000), size: 421888 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    66. C:\Windows\system32\CRYPT32.dll:CRYPT32.dll (000007FEFCDD0000), size: 1495040 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24542
    67. C:\Windows\system32\msvcrt.dll:msvcrt.dll (000007FEFD740000), size: 651264 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.7601.17744
    68. C:\Windows\system32\MSASN1.dll:MSASN1.dll (000007FEFCBB0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    69. C:\Program Files\Unity\2019.3.12f1\Editor\libfbxsdk.dll:libfbxsdk.dll (000007FEE4740000), size: 8511488 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2018.1.1.0
    70. C:\Windows\system32\ADVAPI32.dll:ADVAPI32.dll (000007FEFF270000), size: 897024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    71. C:\Windows\SYSTEM32\sechost.dll:sechost.dll (000007FEFF0B0000), size: 126976 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    72. C:\Windows\system32\RPCRT4.dll:RPCRT4.dll (000007FEFE180000), size: 1228800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    73. C:\Program Files\Unity\2019.3.12f1\Editor\optix.6.0.0.dll:optix.6.0.0.dll (000007FEFA680000), size: 208896 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.0.0.0
    74. C:\Program Files\Unity\2019.3.12f1\Editor\OpenImageDenoise.dll:OpenImageDenoise.dll (000007FECB190000), size: 38039552 (result: 0), SymType: '-deferred-', PDB: ''
    75. C:\Program Files\Unity\2019.3.12f1\Editor\tbb.dll:tbb.dll (000007FEF3520000), size: 413696 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2017.0.2016.1004
    76. C:\Windows\system32\MSVCP120.dll:MSVCP120.dll (000007FEF6120000), size: 679936 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 12.0.40649.5
    77. C:\Windows\system32\MSVCR120.dll:MSVCR120.dll (000007FEF6400000), size: 978944 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 12.0.40649.5
    78. C:\Program Files\Unity\2019.3.12f1\Editor\RadeonImageFilters64.dll:RadeonImageFilters64.dll (000007FEE83D0000), size: 1310720 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 1.4.0.0
    79. C:\Windows\system32\OPENGL32.dll:OPENGL32.dll (000007FEF09D0000), size: 1167360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    80. C:\Windows\system32\GDI32.dll:GDI32.dll (000007FEFE2B0000), size: 421888 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24540
    81. C:\Windows\system32\USER32.dll:USER32.dll (0000000076E40000), size: 1028096 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    82. C:\Windows\system32\LPK.dll:LPK.dll (000007FEFF1E0000), size: 57344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24537
    83. C:\Windows\system32\USP10.dll:USP10.dll (000007FEFD550000), size: 831488 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 1.626.7601.24535
    84. C:\Windows\system32\GLU32.dll:GLU32.dll (000007FEF09A0000), size: 184320 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    85. C:\Windows\system32\DDRAW.dll:DDRAW.dll (000007FEF08A0000), size: 987136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    86. C:\Windows\system32\DCIMAN32.dll:DCIMAN32.dll (000007FEF0890000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24537
    87. C:\Windows\system32\SETUPAPI.dll:SETUPAPI.dll (000007FEFDE40000), size: 1929216 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    88. C:\Windows\system32\CFGMGR32.dll:CFGMGR32.dll (000007FEFCD00000), size: 221184 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    89. C:\Windows\system32\OLEAUT32.dll:OLEAUT32.dll (000007FEFE0A0000), size: 897024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24537
    90. C:\Windows\system32\ole32.dll:ole32.dll (000007FEFDC40000), size: 2093056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24537
    91. C:\Windows\system32\DEVOBJ.dll:DEVOBJ.dll (000007FEFCF50000), size: 106496 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    92. C:\Windows\system32\dwmapi.dll:dwmapi.dll (000007FEF8D00000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    93. C:\Windows\system32\D3DCOMPILER_47.dll:D3DCOMPILER_47.dll (000007FEE8A20000), size: 4345856 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.3.9600.18611
    94. C:\Windows\system32\MSVCP140.dll:MSVCP140.dll (000007FEEB100000), size: 626688 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 14.24.28127.4
    95. C:\Windows\system32\VCRUNTIME140.dll:VCRUNTIME140.dll (000007FEFA7A0000), size: 94208 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 14.24.28127.4
    96. C:\Windows\system32\api-ms-win-crt-runtime-l1-1-0.dll:api-ms-win-crt-runtime-l1-1-0.dll (000007FEFA780000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    97. C:\Windows\system32\ucrtbase.DLL:ucrtbase.DLL (000007FEE8920000), size: 999424 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    98. C:\Windows\system32\api-ms-win-core-timezone-l1-1-0.dll:api-ms-win-core-timezone-l1-1-0.dll (000007FEFABE0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    99. C:\Windows\system32\api-ms-win-core-file-l2-1-0.dll:api-ms-win-core-file-l2-1-0.dll (000007FEFA770000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    100. C:\Windows\system32\api-ms-win-core-localization-l1-2-0.dll:api-ms-win-core-localization-l1-2-0.dll (000007FEFA740000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    101. C:\Windows\system32\api-ms-win-core-synch-l1-2-0.dll:api-ms-win-core-synch-l1-2-0.dll (000007FEFBE00000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    102. C:\Windows\system32\api-ms-win-core-processthreads-l1-1-1.dll:api-ms-win-core-processthreads-l1-1-1.dll (000007FEFA760000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    103. C:\Windows\system32\api-ms-win-core-file-l1-2-0.dll:api-ms-win-core-file-l1-2-0.dll (000007FEFA670000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    104. C:\Windows\system32\api-ms-win-crt-heap-l1-1-0.dll:api-ms-win-crt-heap-l1-1-0.dll (000007FEFA500000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    105. C:\Windows\system32\api-ms-win-crt-string-l1-1-0.dll:api-ms-win-crt-string-l1-1-0.dll (000007FEF8790000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    106. C:\Windows\system32\api-ms-win-crt-stdio-l1-1-0.dll:api-ms-win-crt-stdio-l1-1-0.dll (000007FEF8780000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    107. C:\Windows\system32\api-ms-win-crt-convert-l1-1-0.dll:api-ms-win-crt-convert-l1-1-0.dll (000007FEF8770000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    108. C:\Windows\system32\api-ms-win-crt-locale-l1-1-0.dll:api-ms-win-crt-locale-l1-1-0.dll (000007FEF8760000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    109. C:\Windows\system32\api-ms-win-crt-filesystem-l1-1-0.dll:api-ms-win-crt-filesystem-l1-1-0.dll (000007FEF4C30000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    110. C:\Windows\system32\api-ms-win-crt-time-l1-1-0.dll:api-ms-win-crt-time-l1-1-0.dll (000007FEF8750000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    111. C:\Windows\system32\api-ms-win-crt-environment-l1-1-0.dll:api-ms-win-crt-environment-l1-1-0.dll (000007FEF4C10000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    112. C:\Windows\system32\api-ms-win-crt-math-l1-1-0.dll:api-ms-win-crt-math-l1-1-0.dll (000007FEF4C20000), size: 20480 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    113. C:\Windows\system32\api-ms-win-crt-utility-l1-1-0.dll:api-ms-win-crt-utility-l1-1-0.dll (000007FEF4AB0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.14393.2990
    114. C:\Program Files\Unity\2019.3.12f1\Editor\OpenRL.dll:OpenRL.dll (0000000180000000), size: 12779520 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 1.5.100.0
    115. C:\Windows\system32\VERSION.dll:VERSION.dll (000007FEFBF50000), size: 49152 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    116. C:\Program Files\Unity\2019.3.12f1\Editor\OpenRL_pthread.dll:OpenRL_pthread.dll (0000000000210000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2.9.0.0
    117. C:\Windows\system32\MSVCR100.dll:MSVCR100.dll (0000000074270000), size: 860160 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.40219.325
    118. C:\Windows\system32\MSVCP100.dll:MSVCP100.dll (000000006EDB0000), size: 622592 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.40219.325
    119. C:\Program Files\Unity\2019.3.12f1\Editor\embree.dll:embree.dll (000007FEE2610000), size: 16711680 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2.14.0.0
    120. C:\Program Files\Unity\2019.3.12f1\Editor\umbraoptimizer64.dll:umbraoptimizer64.dll (000007FEE8070000), size: 1306624 (result: 0), SymType: '-deferred-', PDB: ''
    121. C:\Windows\system32\WS2_32.dll:WS2_32.dll (000007FEFF1F0000), size: 315392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23451
    122. C:\Windows\system32\NSI.dll:NSI.dll (000007FEFF260000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23889
    123. C:\Windows\system32\WLDAP32.dll:WLDAP32.dll (000007FEFCF70000), size: 335872 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23889
    124. C:\Windows\system32\Normaliz.dll:Normaliz.dll (0000000077210000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    125. C:\Program Files\Unity\2019.3.12f1\Editor\libcef.dll:libcef.dll (000007FEB0820000), size: 52219904 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 3.2062.1930.0
    126. C:\Windows\system32\PSAPI.DLL:PSAPI.DLL (0000000077200000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    127. C:\Windows\system32\SHLWAPI.dll:SHLWAPI.dll (000007FEFD6C0000), size: 462848 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    128. C:\Windows\system32\WINSPOOL.DRV:WINSPOOL.DRV (000007FEF80B0000), size: 462848 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24383
    129. C:\Windows\system32\COMDLG32.dll:COMDLG32.dll (000007FEFD620000), size: 618496 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    130. C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.24483_none_e372d88f30fbb845\COMCTL32.dll:COMCTL32.dll (000007FEF9880000), size: 2052096 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.10.7601.24483
    131. C:\Windows\system32\SHELL32.dll:SHELL32.dll (000007FEFE320000), size: 14200832 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24468
    132. C:\Windows\system32\WINHTTP.dll:WINHTTP.dll (000007FEFB210000), size: 462848 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24000
    133. C:\Windows\system32\webio.dll:webio.dll (000007FEFB1A0000), size: 409600 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17725
    134. C:\Windows\system32\USERENV.dll:USERENV.dll (000007FEFCD70000), size: 126976 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24535
    135. C:\Windows\system32\profapi.dll:profapi.dll (000007FEFCBC0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    136. C:\Windows\system32\urlmon.dll:urlmon.dll (000007FEFDAB0000), size: 1613824 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 11.0.9600.19597
    137. C:\Windows\system32\api-ms-win-downlevel-ole32-l1-1-0.dll:api-ms-win-downlevel-ole32-l1-1-0.dll (000007FEFCBD0000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    138. C:\Windows\system32\api-ms-win-downlevel-shlwapi-l1-1-0.dll:api-ms-win-downlevel-shlwapi-l1-1-0.dll (000007FEFCD50000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    139. C:\Windows\system32\api-ms-win-downlevel-advapi32-l1-1-0.dll:api-ms-win-downlevel-advapi32-l1-1-0.dll (000007FEFCBE0000), size: 20480 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    140. C:\Windows\system32\api-ms-win-downlevel-user32-l1-1-0.dll:api-ms-win-downlevel-user32-l1-1-0.dll (000007FEFCF40000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    141. C:\Windows\system32\api-ms-win-downlevel-version-l1-1-0.dll:api-ms-win-downlevel-version-l1-1-0.dll (000007FEFCD60000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    142. C:\Windows\system32\api-ms-win-downlevel-normaliz-l1-1-0.dll:api-ms-win-downlevel-normaliz-l1-1-0.dll (000007FEFCD40000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    143. C:\Windows\system32\iertutil.dll:iertutil.dll (000007FEFD7E0000), size: 2932736 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 11.0.9600.19597
    144. C:\Windows\system32\WININET.dll:WININET.dll (000007FEFD000000), size: 4898816 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 11.0.9600.19597
    145. C:\Windows\system32\dhcpcsvc.DLL:dhcpcsvc.DLL (000007FEF7820000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24498
    146. C:\Windows\system32\WTSAPI32.dll:WTSAPI32.dll (000007FEFBC40000), size: 69632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    147. C:\Windows\system32\Secur32.dll:Secur32.dll (000007FEFC7F0000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    148. C:\Windows\system32\SSPICLI.DLL:SSPICLI.DLL (000007FEFC9C0000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    149. C:\Windows\system32\IPHLPAPI.DLL:IPHLPAPI.DLL (000007FEF7F80000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    150. C:\Windows\system32\WINNSI.DLL:WINNSI.DLL (000007FEF7F70000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23889
    151. C:\Windows\system32\IMM32.dll:IMM32.dll (000007FEFCFD0000), size: 188416 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    152. C:\Windows\system32\MSCTF.dll:MSCTF.dll (000007FEFF0D0000), size: 1093632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24520
    153. C:\Windows\system32\OLEACC.dll:OLEACC.dll (000007FEF8050000), size: 344064 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.0.0
    154. C:\Windows\system32\WINMM.dll:WINMM.dll (000007FEF81E0000), size: 241664 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    155. C:\Program Files\Unity\2019.3.12f1\Editor\FreeImage.dll:FreeImage.dll (00000000004B0000), size: 6414336 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 3.18.0.0
    156. C:\Windows\system32\HID.DLL:HID.DLL (000007FEF9840000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    157. C:\Program Files\Unity\2019.3.12f1\Editor\ispc_texcomp.dll:ispc_texcomp.dll (000007FEE7EE0000), size: 1609728 (result: 0), SymType: '-deferred-', PDB: ''
    158. C:\Program Files\Unity\2019.3.12f1\Editor\WinPixEventRuntime.dll:WinPixEventRuntime.dll (000007FEF4C00000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 1.0.1812.6001
    159. C:\Windows\system32\bcrypt.dll:bcrypt.dll (000007FEFC510000), size: 139264 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    160. C:\Program Files\Unity\2019.3.12f1\Editor\SketchUpAPI.dll:SketchUpAPI.dll (000007FEE1D80000), size: 8978432 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 19.0.753.0
    161. C:\Program Files\Unity\2019.3.12f1\Editor\SketchUpCommonPreferences.dll:SketchUpCommonPreferences.dll (000007FEE8850000), size: 483328 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 19.0.753.20342
    162. C:\Windows\system32\WINTRUST.dll:WINTRUST.dll (000007FEFCD90000), size: 241664 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24542
    163. C:\Windows\system32\MSWSOCK.dll:MSWSOCK.dll (000007FEFC420000), size: 348160 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23451
    164. C:\Windows\system32\apphelp.dll:apphelp.dll (000007FEFC9F0000), size: 356352 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    165. C:\Windows\system32\CRYPTBASE.dll:CRYPTBASE.dll (000007FEFCA50000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    166. C:\Windows\system32\uxtheme.dll:uxtheme.dll (000007FEF8F40000), size: 352256 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    167. C:\Windows\Secure64.dll:Secure64.dll (00000000025C0000), size: 131072 (result: 0), SymType: '-deferred-', PDB: ''
    168. C:\Windows\system32\bcryptprimitives.dll:bcryptprimitives.dll (000007FEFC480000), size: 311296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23451
    169. C:\Windows\System32\wship6.dll:wship6.dll (000007FEFC410000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    170. C:\Windows\system32\CLBCatQ.DLL:CLBCatQ.DLL (000007FEFD4B0000), size: 626688 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2001.12.8530.16385
    171. C:\Windows\system32\wbem\wbemprox.dll:wbemprox.dll (000007FEF5930000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    172. C:\Windows\system32\wbemcomn.dll:wbemcomn.dll (000007FEF5D60000), size: 548864 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    173. C:\Windows\system32\CRYPTSP.dll:CRYPTSP.dll (000007FEFC5D0000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24499
    174. C:\Windows\system32\rsaenh.dll:rsaenh.dll (000007FEFC080000), size: 290816 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    175. C:\Windows\system32\RpcRtRemote.dll:RpcRtRemote.dll (000007FEFCB00000), size: 81920 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    176. C:\Windows\system32\wbem\wbemsvc.dll:wbemsvc.dll (000007FEF56F0000), size: 81920 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    177. C:\Windows\system32\wbem\fastprox.dll:fastprox.dll (000007FEF59E0000), size: 925696 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    178. C:\Windows\system32\NTDSAPI.dll:NTDSAPI.dll (000007FEF59B0000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    179. C:\Windows\system32\imagehlp.dll:imagehlp.dll (000007FEFF240000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18288
    180. C:\Windows\system32\ncrypt.dll:ncrypt.dll (000007FEFC540000), size: 327680 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    181. C:\Windows\system32\GPAPI.dll:GPAPI.dll (000007FEFBE40000), size: 110592 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.23452
    182. C:\Windows\system32\cryptnet.dll:cryptnet.dll (000007FEF4E80000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24542
    183. C:\Windows\system32\SensApi.dll:SensApi.dll (000007FEF87C0000), size: 36864 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    184. C:\Windows\System32\wshtcpip.dll:wshtcpip.dll (000007FEFB820000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    185. C:\Windows\System32\netprofm.dll:netprofm.dll (000007FEF2CD0000), size: 475136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    186. C:\Windows\System32\nlaapi.dll:nlaapi.dll (000007FEF9CE0000), size: 86016 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24000
    187. C:\Windows\System32\npmproxy.dll:npmproxy.dll (000007FEF2CB0000), size: 49152 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    188. C:\Windows\system32\dhcpcsvc6.DLL:dhcpcsvc6.DLL (000007FEF7880000), size: 69632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24498
    189. C:\Windows\system32\DNSAPI.dll:DNSAPI.dll (000007FEFC110000), size: 372736 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24168
    190. C:\Windows\System32\fwpuclnt.dll:fwpuclnt.dll (000007FEF7900000), size: 339968 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24000
    191. C:\Windows\system32\rasadhlp.dll:rasadhlp.dll (000007FEF4F00000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    192. C:\Windows\system32\explorerframe.dll:explorerframe.dll (000007FEF26B0000), size: 1880064 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24468
    193. C:\Windows\system32\DUser.dll:DUser.dll (000007FEF8BB0000), size: 274432 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    194. C:\Windows\system32\DUI70.dll:DUI70.dll (000007FEF8C00000), size: 991232 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    195. C:\Windows\System32\MMDevApi.dll:MMDevApi.dll (000007FEFB070000), size: 307200 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    196. C:\Windows\System32\PROPSYS.dll:PROPSYS.dll (000007FEFAF40000), size: 1228800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.7601.17514
    197. C:\Windows\system32\AUDIOSES.DLL:AUDIOSES.DLL (000007FEF0D10000), size: 323584 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24523
    198. C:\Windows\system32\d3d11.dll:d3d11.dll (000007FEF2880000), size: 1921024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16570
    199. C:\Windows\system32\dxgi.dll:dxgi.dll (000007FEF92E0000), size: 380928 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    200. C:\Windows\system32\DXGIDebug.dll:DXGIDebug.dll (000007FEF5BD0000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 9.30.9600.17336
    201. C:\Windows\system32\nvwgf2umx.dll:nvwgf2umx.dll (000007FEEDE80000), size: 37814272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 25.21.14.2531
    202. C:\Windows\system32\nvspcap64.dll:nvspcap64.dll (000007FEE18A0000), size: 2809856 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 3.18.0.102
    203. C:\Windows\system32\ntmarta.dll:ntmarta.dll (000007FEFBDD0000), size: 184320 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    204. C:\Windows\system32\credssp.dll:credssp.dll (000007FEFBFE0000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.24545
    205. C:\Windows\system32\dbghelp.dll:dbghelp.dll (000007FEF38F0000), size: 1200128 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    206. C:\Program Files\Unity\2019.3.12f1\Editor\tbbmalloc.dll:tbbmalloc.dll (000007FEE7C40000), size: 372736 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2017.0.2016.1004
    207. C:\Windows\system32\opencl.dll:opencl.dll (000007FEE17F0000), size: 552960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2.2.1.0
    208. C:\Program Files\Unity\2019.3.12f1\Editor\radeonrays.dll:radeonrays.dll (000007FEE1760000), size: 552960 (result: 0), SymType: '-deferred-', PDB: ''
    209. C:\Program Files\Unity\2019.3.12f1\Editor\Data\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll:mono-2.0-bdwgc.dll (000007FEDDB00000), size: 7778304 (result: 0), SymType: '-deferred-', PDB: ''
    210. C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll:Microsoft.VisualStudio.Setup.Configuration.Native.dll (000007FEE7BF0000), size: 327680 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2.1.1046.44959
    211. C:\Windows\system32\xinput1_3.dll:xinput1_3.dll (0000000073FA0000), size: 122880 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 9.18.944.0
    212. C:\Windows\system32\nvd3dumx.dll:nvd3dumx.dll (000007FEC9E10000), size: 20447232 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 25.21.14.2531
    213. C:\Windows\system32\D3D10Level9.dll:D3D10Level9.dll (000007FEE16B0000), size: 684032 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.21830
    214. C:\Windows\system32\powrprof.dll:powrprof.dll (000007FEFB0C0000), size: 180224 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    215. C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI64.dll:nvSCPAPI64.dll (000007FEDE470000), size: 802816 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.17.14.2531
    216.  
    217. ========== OUTPUTTING STACK TRACE ==================
    218.  
    219. 0x000000014123C652 (Unity) AwakeFromLoadQueue::DetermineQueueIndex
    220. 0x000000014123B240 (Unity) AwakeFromLoadQueue::Add
    221. 0x0000000140EF6B3F (Unity) ActivateSceneAfterReset
    222. 0x0000000140EFEDAD (Unity) EditorSceneManager::ResetOpenScenes
    223. 0x0000000140EFF813 (Unity) EditorSceneManager::RestoreSceneBackups
    224. 0x0000000140969C74 (Unity) PlayerLoopController::EnterPlayMode
    225. 0x000000014097C394 (Unity) PlayerLoopController::SetIsPlaying
    226. 0x000000014097F002 (Unity) Application::TickTimer
    227. 0x00000001412DA9A0 (Unity) MainMessageLoop
    228. 0x00000001412E4AB8 (Unity) WinMain
    229. 0x00000001442A6532 (Unity) __scrt_common_main_seh
    230. 0x0000000076F5556D (kernel32) BaseThreadInitThunk
    231. 0x00000000770B372D (ntdll) RtlUserThreadStart
    232.  
    233. ========== END OF STACKTRACE ===========
    234.  
    235. A crash has been intercepted by the crash handler. For call stack and other details, see the latest crash report generated in:
    236. * C:/Users/PC/AppData/Local/Temp/Unity/Editor/Crashes
    237.  
     
    Last edited: May 17, 2020
    alexeyzakharov likes this.
  11. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,478
    Hi, @alexeyzakharov
    Refactoring or changing scripts is simple to lose the reference pointing to the script component. For example a UI button. Fortunately, the Unity "Missing" reference is handy. Unfortunately, entering in Play Mode the "Missing" references are lost.

    I wish to make a script that runs as soon as the user hits the PlayMode button.
    The script prevents entering in PlayMode. Make a search for Missing References. And if there no missing references then run PlayMode.

    Is there a method, function or attribute that runs the script as soon as the user hits PlayMode?
     
  12. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    489
    Thanks for providing the repro project and editor logs - the crash was related to DestroyImmediate usage in OnEnable of some scripts.
    The fix will be available as a part of 2019.4.1f1
     
  13. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    489
    Yes, you can subscribe to the https://docs.unity3d.com/ScriptReference/EditorApplication-playModeStateChanged.html.
    When PlayMode button is pressed your callback is called with https://docs.unity3d.com/ScriptReference/PlayModeStateChange.ExitingEditMode.html enum value.
    See the diagram in the first post of the thread for the detailed enterplaymode sequence and possible notifications.
     
  14. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    556
    Cannot wait to try it out! ! ! Looking forward to instant Playing :)
     
    alexeyzakharov likes this.
  15. Tortuap

    Tortuap

    Joined:
    Dec 4, 2013
    Posts:
    118
    I just found that UnityEvent are not compatible with this feature. UnityEvent filled in inspector for UI widgets ( Toggle, Buttons, etc ) don't work when the feature is enabled. Callback aren't fired at all. When debugging, looks like onValudChange member ( list of events to fire ) is just empty.

    Is this known on your side ? ( I'm using Unity 2019.3.11f1 )
     
  16. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    461
    This is known and there is an issue for it, which you can vote for:

    https://issuetracker.unity3d.com/is...d-in-play-mode-when-domain-reload-is-disabled

    It our intent to fix all known issues related to this feature soon, as the feature is moving out of experimental for Unity 2020.2
     
    RunninglVlan and SugoiDev like this.
  17. Ramobo

    Ramobo

    Joined:
    Dec 26, 2018
    Posts:
    212
    Instead of this whole initialization method circus, can't Unity just call static constructors again when you enter play mode? Once you figure out which types to reinitialize, it's a one-liner in a loop:
    Code (CSharp):
    1. type.TypeInitializer.Invoke(null, null);
     
    Last edited: Aug 12, 2020
  18. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    424
    How do they figure out which ones to reinitialize?
     
  19. Ramobo

    Ramobo

    Joined:
    Dec 26, 2018
    Posts:
    212
    Actually, this page saying that they use `AppDomain.UnloadDomain()` makes me think that it's actually every type, including `UnityEditor.*` ones.

    EDIT: After playing around with it, it's clear that there are definitely types that are not safe to reset, because the editor just crashed.
    Code (csharp):
    1. Unity.exe caused an Access Violation (0xc0000005)
    2.   in module Unity.exe at 0033:00000000.
     
    Last edited: Aug 12, 2020
    TextusGames likes this.
  20. Ramobo

    Ramobo

    Joined:
    Dec 26, 2018
    Posts:
    212
    This probably works as a homemade solution, provided that you adjust `GetTypesToReset()`. It doesn't impact performance, either.
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using System.Linq;
    4. using System.Reflection;
    5.  
    6. using UnityEngine;
    7.  
    8. using UnityEditor;
    9.  
    10. namespace Application.Editor
    11. {
    12.     [InitializeOnLoad]
    13.     public static class StaticResetter
    14.     {
    15.         static StaticResetter() => EditorApplication.playModeStateChanged += stateChange =>
    16.         {
    17.             if (stateChange == PlayModeStateChange.ExitingEditMode)
    18.             {
    19.                 CallStaticConstructors();
    20.             }
    21.         };
    22.  
    23.         public static void CallStaticConstructors()
    24.         {
    25.             foreach (Type type in GetTypesToReset())
    26.             {
    27.                 type.TypeInitializer?.Invoke(null, null);
    28.             }
    29.         }
    30.  
    31.         public static Type[] GetTypesToReset()
    32.         {
    33.             List<Type> types = new List<Type>();
    34.  
    35.             foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
    36.             {
    37.                 types.AddRange(assembly.GetTypes().Where(type => typeof(MonoBehaviour).IsAssignableFrom(type) && type != typeof(MonoBehaviour)));
    38.             }
    39.  
    40.             return types.ToArray();
    41.         }
    42.     }
    43. }
    44.  
     
    CodeRonnie and firstuser like this.
  21. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,326
    You might want to use the TypeCache API instead:
    https://docs.unity3d.com/ScriptReference/TypeCache.html

    The TypeCache API was introduced to avoid type extraction via regular reflection, because they found it's the type of code that slows Unity down significantly (as the project gets bigger and you're doing it in different places).
     
    RunninglVlan, Wobbers and firstuser like this.
  22. Ramobo

    Ramobo

    Joined:
    Dec 26, 2018
    Posts:
    212
    Huh. I thought that it only supported attributes. In any case, the script is merely a demonstration that's bound to break something. uGUI's Image component in some cases, for one.
     
  23. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    556
    Hi @alexeyzakharov @lukaszunity

    Has anyone tried "Enter Play mode" with 2020.1.2?

    It takes me 10-20s to load up a scene. Is this the same results you guys are getting?

    Are there any other settings I should adjust?
    Thanks for the help!

    screenshot.1.jpg
    screenshot.2.jpg
     
    Last edited: Aug 27, 2020
  24. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    596
    You need to uncheck "Reload Domain"... reloading the domain is what takes 10-20 seconds. Unfortunately, doing that breaks a ton of events and static classes in my project and I think it would take me days to rewrite everything so I could uncheck that box. :-(
     
  25. Somnesis

    Somnesis

    Joined:
    Feb 27, 2020
    Posts:
    22
    How does one use this together with ScriptableObjects? Currently any fields that ScriptableObjects have don't get reset on play / stop. According to the documentation, such setup can be handled on static objects using [RuntimeInitializeOnLoadMethod] but ScriptableObjects are not static. Is there a good built in way to reset them on play / stop?
     
    firstuser likes this.
  26. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    424
    Serializable Variables of scriptableObjects do not get reset because they live in project folder but not in scene and can be edited during play mode and that changes will persist. It is default behavior and does not refer to Configurable enter play mode.
     
  27. vizgl

    vizgl

    Joined:
    Nov 4, 2014
    Posts:
    59
    Faced with the same problem. Here is my solution.

    Create static class:
    Code (CSharp):
    1. public static class ResetablesDatabase
    2. {
    3.    private static List<IResetable> _resetables = new List<IResetable>();
    4.  
    5.    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
    6.    static void ReInitStatic()
    7.    {
    8.       int i = _resetables.Count - 1;
    9.       while (i >= 0)
    10.       {
    11.          IResetable resetable = _resetables[i];
    12.          Object obj = resetable as Object;
    13.        
    14.          // null check, because == is overriden in the Object
    15.          if (obj ?? false)
    16.             resetable.ResetInternalState();
    17.          else
    18.             _resetables.RemoveAt(i);
    19.  
    20.          i--;
    21.       }
    22.    }
    23.  
    24.    public static void Register(IResetable resetable)
    25.    {
    26.       if (_resetables.Contains(resetable))
    27.          return;
    28.      
    29.       _resetables.Add(resetable);
    30.    }
    31.  
    32.    public static void UnRegister(IResetable resetable)
    33.    {
    34.       _resetables.Remove(resetable);
    35.    }
    36. }
    37.  
    And interface:
    Code (CSharp):
    1. public interface IResetable
    2. {
    3.    void ResetInternalState();
    4. }
    Then in your ScriptableObjects:
    Code (CSharp):
    1. public class MyData : ScriptableObject, IResetable
    2. {
    3.    public int resetMe;
    4.  
    5. #if UNITY_EDITOR
    6.    private void OnEnable()
    7.    {
    8.       ResetablesDatabase.Register(this);
    9.    }
    10.  
    11.    private void OnDisable()
    12.    {
    13.       ResetablesDatabase.UnRegister(this);
    14.    }
    15.    private void OnDestroy()
    16.    {
    17.       ResetablesDatabase.UnRegister(this);
    18.    }
    19. #endif
    20.  
    21.    void IResetable.ResetInternalState()
    22.    {
    23.       // reset code here
    24.       resetMe = 0;
    25.    }
    26. }
     
    Last edited: Nov 5, 2020
    ejx61s, Somnesis and firstuser like this.
  28. Somnesis

    Somnesis

    Joined:
    Feb 27, 2020
    Posts:
    22
    Ah thanks! This looks sensible. Sucks to have to do a dance like this in order to use this feature.

    Yeah, I'm speaking of non-serializable fields.
     
    TextusGames likes this.
  29. VincentLKB

    VincentLKB

    Joined:
    Apr 18, 2017
    Posts:
    1
    I can't change the Console.ForegroundColor when I uncheck the Reload Domain.How can I change it?
     
  30. davvjs

    davvjs

    Joined:
    Nov 13, 2016
    Posts:
    10
    I tried this out on an empty project using nothing but the entities package. It lowered the enter play time from 4s to 0.3s on my machine when not having made any code changes. Which is amazing!

    However! It does not seem to have any impact of the complete iteration time of making a code change, switching to the editor and entering play mode. Around 5 seconds of editor freeze regardless what option are used for me (In realistic projects this is of course way longer). Considering how frequent we make code changes and switch to the editor, the configurable play mode is barely scratching the surface in reducing the complete iteration time.

    I would very much like to see the diagram covering complete iteration time. Obviously recompilation is a varying factor but I can assure you it is not the bottleneck.

    Try a URP project, remove all example assets, install entities package (possibly also physics). Take a dummy script and change a number 5 to a number 6 and measure the complete time till you can enter play.

    I take the opportunity in making a shameless plug for my proposal of a ligthweight runner rewritten for programmers. Where neither domain reloading nor freezing the editor would even be necessary because the runner/editor should not run the game in the same process.
    https://forum.unity.com/threads/allow-3rd-party-players-or-make-a-lightweight-editor.1029856/
     
    Last edited: Dec 31, 2020
    glenneroo likes this.
  31. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,326
    That's true. The "Configurable Enter Play Mode" options affect the time the editor requires to switch to Play Mode only.

    It does not affect script compilation, assembly reload and asset database refresh timings. However, Unity Technologies are actively working on getting these things faster too.


    Reducing script compilation time
    https://forum.unity.com/threads/incremental-script-compilation.1021834/


    Reducing AssetDatabase refresh time
    This one is a bit hidden. In Unity 2020.1, they added the "Directory Monitoring" option, that improves asset database refresh timings significantly

    upload_2020-12-31_7-52-5.png


    Reducing AssembyReload time

    They haven't announced they're working on this, but there are several discussions in the forum where people ask Unity to replace reloading the entire AppDomain and reload only what actually changed via AssemblyLoadContext.

    Josh recently posted something related to it. I assume they're working on this issue too, but haven't made a public announcement yet.
    https://forum.unity.com/threads/c-9-support-for-unity.1003597/#post-6665458
     
  32. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,859
    this is too complicated so when are you guys speeding up reloading to the level of 2017?
     
    KarlKarl2000 likes this.
  33. MonkeyDevD

    MonkeyDevD

    Joined:
    Feb 28, 2018
    Posts:
    13
    As the first at our company to experiment with 2020 (we wait for LTS to avoid most of the teething problems new releases have), the out of the box experience was that our entire code library was on fire.

    I thought I found a fix, marking all private fields with [NonSerialized]
    This seemed to have fixed the Sticky-State issue, with the previous play-mode leaking information into the new-playmode.

    Cool, lets do some final checks, present the findings internally and share it on the forums.


    Sadly it turns out I did not have the feature enabled yet.
    Enabling the "Enter Play Mode Options", turns our entire collections of plugins, core functionalities, generic and utilities to a big old pile of null-references and dysfunctional mess of half-assed states after entering Play Mode a second time.

    Each time I do a quick recompile (which triggers an assembly reload), everything works one time again.

    Clearly the speedgain is an awesome step forward, the portion of the code that does load, loads super fast.

    But without a easy to apply quickfix like marking all fields not intended for serialization with [NonSerialized] (still a chore, but could be automated using a coding-rule like: all field must either be public, or marked with either [SerializeField] or [NonSerialized]) and then automatically applied by tools like Rider.


    So, my question is.
    How will this issue be resolved?
    Clearly updating with non-trivial fixes in ALL previously existing code is a non-starter for a lot of people / companies.

    Currently the class level attribute solutions and subscribing to events are both non-intuitive and forgetting them is hard to detect (as there is no code to review) but can lead to difficulties that go unnoticed during code-reviews and initial testing.

    Some of the stuff ALL users now need to get fixed, are external assets, which might or might not update at some point in time. Adding custom functions to all those files, in each code file that might or might not have problems, requires a LOT of validation checks, first checking if the issue exists, secondly to check if everything was caught in the fix.

    We would require an attribute that can be added to all fields that require a reset.
    Then we can just blanket cover EVERYTHING with that tag, statics get reset once, non-statics get reset once per instance.
    All without requiring a function to tie it all together.

    This could work as a custom attribute, using a Editor class to use reflection on the typecache to trigger it all.
    But it would be better if Unity provides it as a possible workaround fix.
    It still requires editing all the files, but then we can just apply the fix, without wondering if we missed anything or adding any 'new code' to deal with the new behavior.
     
    laessnb and Ludiq like this.
  34. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,859
    yep
     
  35. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    98
    100x this. In fact, this was for me a non-starter before I even downloaded any 2020 versions. There should be some magic way for the engine to do this fixup behind the scenes. I don't care if it's a super long one-time process I have to run, with subsequent warnings that I have to rerun this process when it detects something new that will break with the fast enter play mode system. I'd love to be able to use this because the engine is immediately slower to use with each new major version and I'd like to reclaim some of that sluggishness.

    Excellent post -- thanks for writing about your experience.
     
    Last edited: Apr 1, 2021
    firstuser likes this.
  36. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,859
  37. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    556
  38. NibbleByteSSG

    NibbleByteSSG

    Joined:
    Jan 7, 2020
    Posts:
    29
    There is an easier way:
    Code (CSharp):
    1.  
    2. foreach (var so in Resources.FindObjectsOfTypeAll<MyScriptableClass>()) {
    3.     so.Reinit(); // reinitialize your scriptable object.
    4. }
    Drawback is that this will get called even if you are reloading your assembly, which just adds some additional slow down, so not advised to be used in plugins (unless you check the reload domain settings).
     
    firstuser likes this.
  39. MonkeyDevD

    MonkeyDevD

    Joined:
    Feb 28, 2018
    Posts:
    13
    adding

    [NonSerialized]

    to static fields (private or public) seems to help mitigate sticky states