暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

BurstEditorUtility.cs 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #if UNITY_EDITOR
  2. using System;
  3. using UnityEditor;
  4. namespace Unity.Burst.Editor
  5. {
  6. /// <summary>
  7. /// Provides helper methods that can be used in the Editor.
  8. /// </summary>
  9. internal static class BurstEditorUtility
  10. {
  11. #if UNITY_2020_1_OR_NEWER
  12. /// <summary>
  13. /// Requests previously-compiled functions to be cleared from the cache during the next domain reload.
  14. /// Note that this method does not trigger a domain reload itself, so it should be paired with
  15. /// <see cref="EditorUtility.RequestScriptReload()"/> to force a domain reload.
  16. /// </summary>
  17. /// <remarks>
  18. /// During the next domain reload, previously-compiled functions are unloaded from memory,
  19. /// and the corresponding libraries in the on-disk cache are deleted.
  20. ///
  21. /// This method cannot be called while the Editor is in play mode.
  22. /// </remarks>
  23. /// <example>
  24. /// The following example shows calling this method in a test, then triggering a domain reload,
  25. /// and then waiting for the domain reload to finish:
  26. /// <code>
  27. /// BurstEditorUtility.RequestClearJitCache();
  28. /// EditorUtility.RequestScriptReload();
  29. /// yield return new WaitForDomainReload();
  30. /// </code>
  31. /// </example>
  32. public static void RequestClearJitCache()
  33. {
  34. if (EditorApplication.isPlayingOrWillChangePlaymode)
  35. {
  36. throw new InvalidOperationException("This method cannot be called while the Editor is in play mode");
  37. }
  38. BurstCompiler.RequestClearJitCache();
  39. }
  40. #endif
  41. }
  42. }
  43. #endif