在A程序使用:C# 安全队列
using System.Collections.Concurrent;
public static ConcurrentQueue<string> queue_data = new ConcurrentQueue<string>(); //安全的队列,送数据给显示
发送数据:
queue_data.Enqueue("123");
在B程序接收数据:
if (movetest.queue_data.TryDequeue(out string data_show)) //movetest是A程序的class名字
{
Debug.Log("收到了 = " + data_show);
}