No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ExitPlayModeTask.cs 778B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks
  5. {
  6. internal class ExitPlayModeTask : TestTaskBase
  7. {
  8. public ExitPlayModeTask()
  9. {
  10. RunOnCancel = true;
  11. RunOnError = ErrorRunMode.RunAlways;
  12. }
  13. public Func<bool> IsInPlayMode = () => Application.isPlaying;
  14. public Action ExitPlayMode = () => EditorApplication.isPlaying = false;
  15. public override IEnumerator Execute(TestJobData testJobData)
  16. {
  17. if (!IsInPlayMode())
  18. {
  19. yield break;
  20. }
  21. ExitPlayMode();
  22. while (IsInPlayMode())
  23. {
  24. yield return null;
  25. }
  26. }
  27. }
  28. }