public static void Update() { while (Instance.m_commandQueue.Count > 0) { QueuedCommand cmd = Instance.m_commandQueue.Dequeue(); cmd.command.m_callback(cmd.args); } }
/* Queue a command to be executed on update on the main thread */ public static void Queue(CommandAttribute command, string[] args) { QueuedCommand queuedCommand = new QueuedCommand(); queuedCommand.command = command; queuedCommand.args = args; Instance.m_commandQueue.Enqueue(queuedCommand); }