/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.visualscripting@1.9.4/Runtime/VisualScripting.Core/Unity/UnityThread.cs
32 строки
870 B
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
using System; using System.Collections.Concurrent; using System.Diagnostics; using System.Threading; namespace Unity.VisualScripting { public static class UnityThread { public static Thread thread = Thread.CurrentThread; public static Action<Action> editorAsync; public static bool allowsAPI => !Serialization.isUnitySerializing && Thread.CurrentThread == thread; public static ConcurrentQueue<Action> pendingQueue = new ConcurrentQueue<Action>(); internal static void RuntimeInitialize() { thread = Thread.CurrentThread; } [Conditional("UNITY_EDITOR")] public static void EditorAsync(Action action) { if (editorAsync == null) pendingQueue.Enqueue(action); else editorAsync.Invoke(action); } } }