untangle-puzzlegame/Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Tasks/EnterPlayModeTask.cs
2025-04-17 17:33:08 -04:00

31 lines
770 B
C#

using System;
using System.Collections;
using UnityEngine;
namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks
{
internal class EnterPlayModeTask : TestTaskBase
{
public Func<bool> IsInPlayMode = () => Application.isPlaying;
public Action EnterPlayMode = () => EditorApplication.isPlaying = true;
public override IEnumerator Execute(TestJobData testJobData)
{
if (IsInPlayMode())
{
yield break;
}
// Give the UI a change to update the progress bar, sa entering playmode freezes.
yield return null;
EnterPlayMode();
while (!IsInPlayMode())
{
yield return null;
}
}
}
}