示例#1
0
        private static void OnDomainUnload(object sender, EventArgs e)
        {
            if (DebuggingLevel > 2)
            {
                UnityEngine.Debug.Log($"Burst - OnDomainUnload");
            }

            lock (EagerCompilationLockObject)
            {
                EagerCompilationTokenSource.Cancel();
            }

            BurstCompiler.Cancel();

#if UNITY_2020_1_OR_NEWER
            // Because of a check in Unity (specifically SCRIPTINGAPI_THREAD_AND_SERIALIZATION_CHECK),
            // we are not allowed to call thread-unsafe methods (like Progress.Exists) after the
            // kApplicationTerminating bit has been set. And because the domain is unloaded
            // (thus triggering AppDomain.DomainUnload) *after* that bit is set, we can't call Progress.Exists
            // during shutdown. So we check _isQuitting here. When quitting, it's fine for the progress item
            // not to be removed since it's all being torn down anyway.
            if (!_isQuitting && Progress.Exists(BurstProgressId))
            {
                Progress.Remove(BurstProgressId);
                BurstProgressId = -1;
            }
#endif
        }
示例#2
0
        private static void OnAssemblyCompilationFinished(string arg1, CompilerMessage[] arg2)
        {
            // On assembly compilation finished, we cancel all pending compilation
            if (DebuggingLevel > 2)
            {
                UnityEngine.Debug.Log("Burst - Assembly compilation finished - cancelling any pending jobs");
            }

            BurstCompiler.Cancel();
        }
示例#3
0
        private static void EditorApplicationOnPlayModeStateChanged(PlayModeStateChange state)
        {
            if (DebuggingLevel > 2)
            {
                UnityEngine.Debug.Log($"Burst - Change of Editor State: {state}");
            }

            if (state == PlayModeStateChange.ExitingPlayMode)
            {
                if (DebuggingLevel > 2)
                {
                    UnityEngine.Debug.Log("Burst - Exiting PlayMode - cancelling any pending jobs");
                }

                // Cancel also on exit PlayMode
                BurstCompiler.Cancel();
            }
        }