Esempio n. 1
0
        public static void Shutdown()
        {
#if DEBUG
            // Instead of silently skipping, ensure we have predictable control over initialization and shutdown sequence.
            if (!Initialized)
            {
                throw new InvalidOperationException("DotsRuntime.Shutdown() already called");
            }
            Initialized = false;
#endif

#if ENABLE_PROFILER
            Profiler.Shutdown();
#endif
#if ENABLE_PLAYERCONNECTION
            Logger.Shutdown();
            Connection.Shutdown();
#endif
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Shutdown();
#endif
            JobsUtility.Shutdown();

#if UNITY_DOTSRUNTIME_TRACEMALLOCS
            var leaks = Unity.Collections.LowLevel.Unsafe.UnsafeUtility.DebugGetAllocationsByCount();
            UnityEngine.Assertions.Assert.IsTrue(leaks.Count == 0);
#endif
        }
Esempio n. 2
0
    public static int Main(string[] args)
    {
        var result = new AutoRun().Execute(args);

#if !UNITY_SINGLETHREADED_JOBS
        // Currently, Windows (.NET) will exit without requiring other threads to complete
        // OSX (Mono), on the other hand, requires all other threads to complete
        JobsUtility.Shutdown();
#endif
        return(result);
    }