public void CreateQuickGame(uint minOpponents, uint maxOpponents, uint variant, ulong exclusiveBitMask, RealTimeMultiplayerListener listener) { lock (mSessionLock) { RoomSession newSession = new RoomSession(mRealtimeManager, listener); if (mCurrentSession.IsActive()) { Logger.e("Received attempt to create a new room without cleaning up the old one."); newSession.LeaveRoom(); } else { mCurrentSession = newSession; Logger.d("QuickGame: Setting MinPlayersToStart = " + minOpponents); mCurrentSession.MinPlayersToStart = minOpponents; using (RealtimeRoomConfigBuilder realtimeRoomConfigBuilder = RealtimeRoomConfigBuilder.Create()) { RealtimeRoomConfig config = realtimeRoomConfigBuilder.SetMinimumAutomatchingPlayers(minOpponents).SetMaximumAutomatchingPlayers(maxOpponents).SetVariant(variant) .SetExclusiveBitMask(exclusiveBitMask) .Build(); using (config) { GooglePlayGames.Native.PInvoke.RealTimeEventListenerHelper helper = HelperForSession(newSession); try { newSession.StartRoomCreation(mNativeClient.GetUserId(), delegate { mRealtimeManager.CreateRoom(config, helper, newSession.HandleRoomResponse); }); } finally { if (helper != null) { ((IDisposable)helper).Dispose(); } } } } } } }