public static GPMPController GetInstance() { if (instance == null) { instance = new GPMPController(); } return(instance); }
void Update() { if (matchStarted) { //DebugMP.Log("Last acknowledgement from opponent was " + matchTimeOutCounter + " seconds ago."); matchTimeOutCounter += Time.deltaTime; if (matchTimeOutCounter >= matchTimeOut) { GPMPController.GetInstance().OnParticipantLeft(null); } } }
/// <summary> /// Initializes Google Play Service /// </summary> public void Init() { // Enables saving game progress. config = new PlayGamesClientConfiguration.Builder() .EnableSavedGames() .WithInvitationDelegate(GPMPController.GetInstance().OnInvitationReceived) .Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; // Set Google Play Service as Social platform PlayGamesPlatform.Activate(); isInitialized = true; }