/// <summary> /// Hosts the user placed cloud anchor and associates the resulting Id with the current room. /// </summary> private void _HostLastPlacedAnchor() { #if !UNITY_IOS var anchor = (Anchor)m_LastPlacedAnchor; #else var anchor = (UnityEngine.XR.iOS.UnityARUserAnchorComponent)m_LastPlacedAnchor; #endif UIManager.Instance().ShowHostingModeAttemptingHost(); XPSession.CreateCloudAnchor(anchor).ThenAction(result => { if (result.Response != CloudServiceResponse.Success) { UIManager.Instance().ShowHostingModeBegin( string.Format("Failed to host cloud anchor: {0}", result.Response)); return; } RoomSharingServer.SaveCloudAnchorToRoom(m_CurrentRoom, result.Anchor); UIManager.Instance().ShowHostingModeBegin("Cloud anchor was created and saved."); GameManager.Instance().matchGroup = m_CurrentRoom.ToString(); GameManager.Instance().anchorTransform = result.Anchor.transform; GameManager.Instance().isConnected = true; //GameManager.Instance().OnHostedandResolved(); }); }
/// <summary> /// Hosts the user placed cloud anchor and associates the resulting Id with the current room. /// </summary> private void _HostLastPlacedAnchor() { #if !UNITY_IOS || ARCORE_IOS_SUPPORT #if !UNITY_IOS var anchor = (Anchor)m_LastPlacedAnchor; #else var anchor = (UnityEngine.XR.iOS.UnityARUserAnchorComponent)m_LastPlacedAnchor; #endif UIController.ShowHostingModeAttemptingHost(); XPSession.CreateCloudAnchor(anchor).ThenAction(result => { if (result.Response != CloudServiceResponse.Success) { UIController.ShowHostingModeBegin( string.Format("Failed to host cloud anchor: {0}", result.Response)); return; } RoomSharingServer.SaveCloudAnchorToRoom(m_CurrentRoom, result.Anchor); UIController.ShowHostingModeBegin("Cloud anchor was created and saved."); }); #endif }