void CheckForLocalCollaborationData(ARKitSessionSubsystem subsystem) { // Check for new data and queue it if (subsystem.collaborationDataCount > 0) { CollaborationNetworkingIndicator.NotifyHasCollaborationData(); lock (m_CollaborationDataSendQueue) { while (subsystem.collaborationDataCount > 0) { m_CollaborationDataSendQueue.Enqueue(subsystem.DequeueCollaborationData()); } } } }
static async UniTask SendCollaborationDataAsync(ARKitSessionSubsystem arKitSessionSubsystem, UnityMCSessionNativeInterface mcSession, CancellationToken cancellationToken) { while (true) { while (0 < arKitSessionSubsystem.collaborationDataCount) { var data = arKitSessionSubsystem.DequeueCollaborationData(); if (!data.valid) { continue; } mcSession.SendToAllPeers((PackableARCollaborationData)data); } await UniTask.Yield(); cancellationToken.ThrowIfCancellationRequested(); } }
void CheckForLocalCollaborationData(ARKitSessionSubsystem subsystem) { // Exit if no new data is available if (subsystem.collaborationDataCount == 0) { return; } lock (m_CollaborationDataSendQueue) { // Enqueue all new collaboration data with critical priority while (subsystem.collaborationDataCount > 0) { var collaborationData = subsystem.DequeueCollaborationData(); // As all data in this sample is sent over TCP, only send critical data if (collaborationData.priority == ARCollaborationDataPriority.Critical) { m_CollaborationDataSendQueue.Enqueue(collaborationData); CollaborationNetworkingIndicator.NotifyHasCollaborationData(); } } } }