Game/Library/PackageCache/com.unity.package-manager-ui@2.0.13/Editor/Sources/Services/Common/ThreadedDelay.cs
2021-01-16 18:29:12 +01:00

36 lines
753 B
C#

using System.Threading;
namespace UnityEditor.PackageManager.UI
{
internal class ThreadedDelay
{
public int Length { get; set; } // In milliseconds
public bool IsDone { get; private set; }
public ThreadedDelay(int length = 0)
{
Length = length;
IsDone = false;
}
public void Start()
{
if (Length <= 0)
{
IsDone = true;
return;
}
IsDone = false;
Thread newThread = new Thread(() =>
{
Thread.Sleep(Length);
IsDone = true;
});
newThread.Start();
}
}
}