public static void RunOnMainThread(System.Action action, ETaskType type = ETaskType.task, int id = 0) { if (sInitilized && action != null) { lock (sInstance.mLock) { TaskWithoutArg task = sInstance.GetTask(id); task.Task = action; if (type == ETaskType.task) { sInstance.mTasks.Enqueue(task); } else if (type == ETaskType.lateTask) { sInstance.mLateTasks.Enqueue(task); } } } #if UNITY_EDITOR else if (!sInitilized && Application.isPlaying) { RTLog.LogError(LogCat.Game, "MainThread not initialized."); } #endif }
public static void RunOnMainThread(System.Action action) { if (sInitilized && action != null) { lock (sInstance.mLock) { TaskWithoutArg task = sInstance.GetTask(); task.mTask = action; sTasks.Enqueue(task); } } }