Files
2025-11-30 08:35:03 +02:00

25 lines
568 B
C#

using System.Threading;
using UnityEditor;
namespace Needle.Engine.Utils
{
#if UNITY_EDITOR
[InitializeOnLoad]
#endif
internal static class UnityThreads
{
private static readonly Thread _mainThread;
static UnityThreads()
{
_mainThread = Thread.CurrentThread;
}
/// <summary>
/// Returns true if we're currently on the main thread
/// </summary>
public static bool IsMainThread()
{
return Thread.CurrentThread == _mainThread;
}
}
}